3
$\begingroup$
from sklearn.model_selection import RandomizedSearchCV,GridSearchCV
import xgboost

classifier=xgboost.XGBClassifier()
random_search=RandomizedSearchCV(classifier,param_distributions=params,n_iter=5,scoring='roc_auc',n_jobs=-1,cv=5,verbose=3)
random_search.best_estimator_

.AttributeError: 'RandomizedSearchCV' object has no attribute 'best_estimator_'

$\endgroup$
1

1 Answer 1

3
$\begingroup$

You have to fit the RandomizedSearchCV first in order to access this attribute.

random_search.fit(X_train, y_train)
print(random_search.best_estimator_)
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.