machinery
machinery

Reputation: 6290

Meaning of fit_params for RandomizedSearchCV

I would like to use RandomizedSearchCV from scikit-learn. In the constructor I can pass param_distributions, i.e. the distributions for the different parameters I want to optimize. But there is also the fit_params attribute. From the documentation I don't see what the meaning of it is. In which cases should I use fit_params instead of param_distributions?

Upvotes: 0

Views: 440

Answers (1)

Slater Victoroff
Slater Victoroff

Reputation: 21904

One is for initialization parameters, and the other is for parameters added when the actual fit method is called.

Most of the things you want to vary are going to be set through param_distributions. Things like regularization, hyperparameters, loss functions, etc... are specific to the model instantiation.

On the other side there are pieces that are passed in to the fit call that can sometimes be required. For instance, LogisticRegression supports sample_weights (docs). If that's important to you, then you can add those in there, but again CV is usually about locking down your hyperparameters, so I'd wager that param_distributions is what you're looking for most of the time.

Upvotes: 2

Related Questions