Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# define the parameter grid
grid_parameters = {'n_estimators': [80, 90, 100, 110, 115, 120],
'max_depth': [3, 4, 5, 6],
'max_features': [None, 'auto', 'sqrt', 'log2'],
'min_samples_split': [2, 3, 4, 5]}
# define the RandomizedSearchCV class for trying different parameter combinations
random_search = RandomizedSearchCV(estimator=GradientBoostingClassifier(),
param_distributions=grid_parameters,
cv=5,
n_iter=150,
n_jobs=-1)
# fitting the model for random search
random_search.fit(X_train, y_train)
# print best parameter after tuning
print(random_search.best_params_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment