September 2018
Beginner to intermediate
154 pages
3h 51m
English
We can compare the best model that we got while tuning the parameters with the best model that we have been using without the help of tuning n_estimators with a value of 50, max_depth with a value of 16, and max_features as auto, and in both the cases it was random forest. The following code shows the values of the parameters of both the tuned and untuned models:
## Random ForestsRF_model1 = RandomForestRegressor(n_estimators=50, max_depth=16, random_state=123, n_jobs=-1)RF_model1.fit(X_train, y_train)RF_model1_test_mse = mean_squared_error(y_pred=RF_model1.predict(X_test), y_true=y_test)## Random Forest with tunned parameters RF_tunned_test_mse = mean_squared_error(y_pred=RF_classifier.predict(X_test), ...
Read now
Unlock full access