hyperopt / hyperopt-sklearn

Hyper-parameter optimization for sklearn
hyperopt.github.io/hyperopt-sklearn
Other
1.57k stars 270 forks source link

InvalidParameterError when running the classifier #198

Closed roydbt closed 1 year ago

roydbt commented 1 year ago

When I run

model = HyperoptEstimator(classifier=any_classifier('cla'), preprocessing=any_preprocessing('pre'))

I get

InvalidParameterError: The 'base_estimator' parameter of AdaBoostClassifier must be an object implementing 'fit' and 'predict' or a str among {'deprecated'}. Got None instead.
mandjevant commented 1 year ago

Hey, thanks for raising this question. In sklearn 1.2, the base_estimator parameter was renamed to estimator.

Hyperopt-sklearn is not yet compatible with sklearn 1.2. as I have been busy irl. A few months ago, other issues were raised regarding incompatibility. And the requirements.txt was updated to reflect this.

For next time, take a look at requirements.txt,

It says:

scikit-learn>=1.0,<1.2

Your installation of scikit-learn must be 1.2 or newer. Downgrading should solve your issue.

The following commands in your terminal should downgrade your sklearn installation. pip uninstall scikit-learn `pip install 'scikit-learn>=1.0,<1.2'

Let me know if it works!

roydbt commented 1 year ago

Installed scikit-learn==1.1.0 and it worked!