Answers for "RandomizedSearch for Random Forest Classifier"

0

RandomizedSearch for Random Forest Classifier

# create random forest classifier model
rf_model = RandomForestClassifier()

# set up random search meta-estimator
# this will train 100 models over 5 folds of cross validation (500 models total)
clf = RandomizedSearchCV(rf_model, model_params, n_iter=100, cv=5, random_state=1)

# train the random search meta-estimator to find the best model out of 100 candidates
model = clf.fit(X, y)

# print winning set of hyperparameters
from pprint import pprint
pprint(model.best_estimator_.get_params())
Posted by: Guest on July-18-2021

Code answers related to "RandomizedSearch for Random Forest Classifier"

Python Answers by Framework

Browse Popular Code Answers by Language