Created
December 26, 2021 16:47
-
-
Save yashprakash13/2fdb20900538d92f5d73817bd8c67d01 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
# Do grid search | |
from sklearn.model_selection import GridSearchCV | |
rf_classifier = RandomForestClassifier(random_state=0) | |
rf_model_pipeline = Pipeline(steps=[ | |
('preprocessing', columns_transformer), | |
('rf_model', rf_classifier), | |
]) | |
params_dict = {'rf_model__n_estimators' : np.arange(5, 100, 1), 'rf_model__criterion': ['gini', 'entropy'], 'rf_model__max_depth': np.arange(10, 200, 5)} | |
grid_search = GridSearchCV(rf_model_pipeline, params_dict, cv=10, n_jobs=-1) | |
grid_search.fit(X_train, y_train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment