Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing in

  Enroll Now

End to End ML Project - Train a Random Forest model

Now let's train a Random Forest model the same way we trained the Decision Tree model and see how it performs.

  • Import the RandomForestRegressor class from Scikit-learn

    from sklearn.ensemble import <<your code goes here>>
  • Now let's train the model with our training data

    forest_reg = RandomForestRegressor(n_estimators=100, random_state=42)
    forest_reg.<<your code goes here>>(housing_prepared, housing_labels)
  • Now we will predict using out model

    housing_predictions = forest_reg.<<your code goes here>>(housing_prepared)
  • Finally, we will evaluate our model

    forest_mse = mean_squared_error(housing_labels, housing_predictions)
    forest_rmse = np.sqrt(forest_mse)

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...