How To Use Cross-validation With Custom Estimator In Sklearn?
I have written a custom estimator class with a fit and transform method. I am able to create a model, train and predict using the model. However, while doing cross-validation, I ru
Solution 1:
I would suggest having the preprocessor inside the pipeline itself. Cross_val_score
would try to copy the params of the estimator, it would break when the estimator cannot return the params while calling get_params()
.
I am not sure whether your pipeline parameter is a Sklearn pipeline because the pipeline object is not iterable.
Solution 2:
As suggested in few comments, this error is because self.processor
can't be deep-cloned.
Baca Juga
- How To Determine The Learning Rate And The Variance In A Gradient Descent Algorithm?
- Why Is It In Pytorch When I Make A Copy Of A Network's Weight It Would Be Automatically Updated After Back-propagation?
- Why The Model Is Training On Only 1875 Training Set Images If There Are 60000 Images In The Mnist Dataset?
So, the workaround for this error is to remove preprocessing step from this class and move it as independent preprocessing step or inside the pipeline itself.
Post a Comment for "How To Use Cross-validation With Custom Estimator In Sklearn?"