-
-
Save amandaiglesiasmoreno/909c5fe0ad61e6eb307a3940ce4f118d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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