Exercise

Random Forest: prediction

Now you need to make some predictions with your random forest model. The syntax is the same as with the gradient boosted trees model.

Instructions

100 XP

A Spark connection has been created for you as spark_conn. Tibbles attached to the training and testing datasets stored in Spark have been pre-defined as track_data_to_model_tbl and track_data_to_predict_tbl respectively. The random forest model has been pre-defined as random_forest_model.

  • Select the year column of track_data_to_predict_tbl.
  • Collect the results.
  • Add a column containing the predictions.
    • Use mutate() to add a field named predicted_year.
    • This field should be created by calling predict().
    • Pass the model and the testing data to predict().