text_plain_output_1.png image_output_1.png
from sklearn.ensemble import RandomForestClassifier

from sklearn.model_selection import GridSearchCV

from sklearn.preprocessing import StandardScaler

from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
x_train = scaler.fit_transform(x_train)
x_test = scaler.transform(x_test)

from sklearn.model_selection import GridSearchCV
from sklearn.ensemble import RandomForestClassifier
rf_model = RandomForestClassifier()
rf_params = {'n_estimators': [5, 50, 250], 'max_depth': [2, 4, 8, 16, 32, None]}
cv = GridSearchCV(rf_model, rf_params, cv=5)
cv.fit(x_train, y_train)

cv.best_estimator_