ray-project / tune-sklearn

A drop-in replacement for Scikit-Learn’s GridSearchCV / RandomizedSearchCV -- but with cutting edge hyperparameter tuning techniques.
https://docs.ray.io/en/master/tune/api_docs/sklearn.html
Apache License 2.0
465 stars 52 forks source link

Saved model with joblib NotFittedError unpredictably #118

Closed JesperDramsch closed 3 years ago

JesperDramsch commented 4 years ago

Thanks for the library, been getting a lot of mileage out of this.

I'm fitting a TuneSearchCV instance

TuneSearchCV(
                model,
                config,
                n_trials=n_trials,
                cv=3,
                refit=True,
                search_optimization="hyperopt",
                loggers=["mlflow"],
                n_jobs=n_jobs,
                use_gpu=True
            )

and saving the instance with joblib dump, however, some of the saved models upon loading, return a NotFittedError after being loaded again:

sklearn.exceptions.NotFittedError: This TuneSearchCV instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.

I tested the Estimators and they were fitted before saving. I'm kind of at the end of my debugging skills and wonder if this is a problem with tune-sklearn, possibly even related to #107?

richardliaw commented 4 years ago

Hmm that's super weird. Do you have a simple repro script that I can run?

richardliaw commented 3 years ago

Closing this now, not sure how to repro.