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

error when using multimetric scoring with refit=False #230

Closed yonil7 closed 2 years ago

yonil7 commented 2 years ago

https://github.com/ray-project/tune-sklearn/blob/1c6909223b2e892e97a07151f14d19b80bbffad4/tune_sklearn/tune_basesearch.py#L486

        if self._is_multi:
            if not isinstance(self.refit,
                              str) or self.refit not in self.scoring_:
                raise ValueError("When using multimetric scoring, refit "
                                 "must be the name of the scorer used to "
                                 "pick the best parameters.")

This code should check that self.refit is not set to False before raising an error

Yard1 commented 2 years ago

This is intended, refit is required to specify which metric should be optimized for.