Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Nov 19, 2020
Embed
What would you like to do?
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