Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with pipeline #5

Open
developpeur-windev-php-python opened this issue Apr 30, 2019 · 1 comment
Open

error with pipeline #5

developpeur-windev-php-python opened this issue Apr 30, 2019 · 1 comment

Comments

@developpeur-windev-php-python

Hello,

I have always an error
ValueError: Invalid parameter n_estimators for estimator Pipeline(memory=None,
steps=[('umap', UMAP(a=None, angular_rp_forest=False, b=None, init='spectral',
learning_rate=1.0, local_connectivity=1.0, metric='euclidean',
metric_kwds=None, min_dist=0.1, n_components=2, n_epochs=None,
n_neighbors=15, negative_sample_rate=5, random_state=456,
repulsion_strength=1.0, s...ax_iter=1000,
multi_class='ovr', penalty='l2', random_state=None, tol=0.0001,
verbose=0))]). Check the list of available parameters with estimator.get_params().keys().

my code
from sklearn.model_selection import RandomizedSearchCV
umap2 = umap.UMAP(random_state=456)
svc=LinearSVC(dual=False)
pipeline = Pipeline([("umap", umap2),
("svc", svc)])

params_grid_pipeline = {"umap__n_neighbors": [5,20],
"umap__n_components": [15, 25, 50],
"svc__C": [10**k for k in range(-3, 4)],
'svc__random_state':[43]}

gs=HyperbandSearchCV(estimator=pipeline, param_distributions=params_grid_pipeline, scoring='recall', cv=10, verbose=1,n_jobs = 5)

gs = gs.fit(X_train.values,y_train.values.ravel())

My params are good

@thuijskens
Copy link
Owner

If you read the documentation of the HyperbandSearchCV class, you will see that there is an argument resource_param that you need to set. It tells the method which parameter corresponds to the cost parameter for hyperband, and is by default set to n_estimators. You'll have to change it to whatever makes sense for your method

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

No branches or pull requests

2 participants