Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created November 19, 2020 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/0dd095f88533a35d5e4a22958abf9551 to your computer and use it in GitHub Desktop.
Save amankharwal/0dd095f88533a35d5e4a22958abf9551 to your computer and use it in GitHub Desktop.
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import GridSearchCV
lr_grid = {'max_depth' : [4,8,16,32,64,128],
'criterion' : ['entropy','gini']}
clf = RandomForestClassifier(n_estimators=100, max_features='sqrt', random_state=42)
gs = GridSearchCV(estimator = clf, param_grid=lr_grid,cv = 5)
gs.fit(x_train,y_train)
y_pred = gs.predict(x_test)
gs.best_params_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment