Login using Social Account
     Continue with GoogleLogin using your credentials
Train the Random Forest Model on the 'Training' data set using cross validation and calculate 'mean absolute error' and 'root mean squared error' (RMSE) for this model.
Display these scores using display_scores()
function.
Create a RandomForestRegressor instance, called forest_reg
by passing random seed of 42 and n_estimators=150
to the RandomForestRegressor.
Call cross_val_score()
function, to perform training and cross validation and to calculate the mean absolute error scores, by passing to it the following:
RandomForestRegressor object forest_reg
trainingCols dataframe
trainingLabels dataframe
parameter cv with value 10 (cv=10)
scoring parameter with value "neg_mean_absolute_error"
rf_mae_scores = -cross_val_score(<<your code comes here>>)
display_scores(rf_mae_scores)
Call cross_val_score()
function, to perform training and cross validation and to calculate the mean squared error scores, by passing to it the following:
RandomForestRegressor object forest_reg
trainingCols dataframe
trainingLabels dataframe
parameter cv with value 10 (cv=10)
scoring parameter with value "neg_mean_squared_error"
rf_mse_scores = np.sqrt(-cross_val_score(<<your code comes here>>))
display_scores(rf_mse_scores)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Answer is not availble for this assesment
Loading comments...