'RandomizedSearchCV' object has no attribute 'best_estimator_' 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_'
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_)