TypeError: __init__() got an unexpected keyword argument 'iid'

3.1k Views Asked by At

I found best parameters and best score using GridSearchCV and RandomizedSearchCV for my TCSVM model. and now i want to use the BayesSearchCV in order to compare it with previous methods, but i got this error __init__() got an unexpected keyword argument 'iid'

this is my code that i used:

    model2 = make_pipeline(StandardScaler(), SVC())
    parameter_grid = {
            'C': Real(1e-5, 1e+3, prior='log-uniform'),
            'gamma': Real(2e-2, 2e+3, prior='log-uniform'),
            'degree': Integer(1, 8),
            'kernel': Categorical(['linear', 'poly', 'rbf']),
        }
    grid_searchdt = BayesSearchCV(estimator=model2, search_spaces=parameter_grid, n_iter=32, cv=5, random_state=0,
                                  iid=True)
    grid_searchdt.fit(X_Train, Y_Train)
    grid_searchdt.score(X_Test, Y_Test)
    print("Score opt =", grid_searchdt.score(X_Test, Y_Test))
    print("Best_Params =", grid_searchdt.best_params_)
    print("Best_Score =", grid_searchdt.best_score_)

i read some solution that said i need to downgrade scikit-learn version but it didn't works for me. any solution please.

1

There are 1 best solutions below

1
On

Finally it works, i uninstall scikit-learn using pip uninstall scikit-learn, and install it again, after that i installed scikit-optimize using pip install --upgrade scikit-optimize==0.23.3 so after that when i run my code it works pretty fine.

thank you @furas for your help