Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

[bug] Random search algorithm perform only 1 trial regardless of the actual n_trials value given to TuneSearchCV #190

Closed
mariesosa opened this issue Mar 4, 2021 · 2 comments

Comments

@mariesosa
Copy link

Describe the bug

The random search algorithm perform only one trial regardless of the actual n_trials value given to TuneSearchCV.

Steps/Code to Reproduce

from tune_sklearn import TuneSearchCV
from ray import tune
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_blobs

# Create a test dataset
X, y = make_blobs(n_samples=1000, centers=2, n_features=5)

# Define the algorithm to optimize
clf = RandomForestClassifier()
params = {'max_depth': tune.randint(5, 20)}

# Perform hyperparameter optimization
tune_search = TuneSearchCV(
    clf, params, cv=5, scoring='roc_auc', random_state=0,
    search_optimization="random", n_trials=4
)
tune_search = tune_search.fit(X, y)
print("n_trials = %d" % tune_search.n_trials)

Expected Results

n_trials = 4

Actual Results

n_trials = 1

Versions

numpy==1.18.4
ray==1.2.0
scikit-learn==0.24.1
tune_sklearn==0.2.1

@Yard1
Copy link
Member

Yard1 commented Mar 4, 2021

I believe this was fixed on master already. Could you install the development version with pip install -U git+https://github.com/ray-project/tune-sklearn.git and try again?

@mariesosa
Copy link
Author

Indeed it works, and it was probably fixed by pull-request #180.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants