Session Ready
Exercise

Build & evaluate the best model

Using cross-validation you were able to identify the best model for predicting life_expectancy using all the features in gapminder. Now that you've selected your model, you can use the independent set of data (testing_data) that you've held out to estimate the performance of this model on new data.

You will build this model using all training_data and evaluate using testing_data.

Instructions
100 XP
  • Use ranger() to build the best performing model (mtry = 4) using all of the training data. Assign this to best_model.
  • Extract the life_expectancy column from testing_data and assign it to test_actual.
  • Predict life_expectancy using the best_model on the testing data and assign it to test_predicted.
  • Calculate the MAE using test_actual and test_predicted vectors.