Exercise

Random Forest: visualization

Now you need to plot the predictions. With the gradient boosted trees model, you drew a scatter plot of predicted responses vs. actual responses, and a density plot of the residuals. You are now going to adapt those plots to display the results from both models at once.

Instructions

100 XP

A local tibble both_responses, containing predicted and actual years for both models, has been pre-defined.

  • Update the predicted vs. actual response scatter plot.
    • Use the both_responses dataset.
    • Add a color aesthetic to draw each model in a different color. Use color = model.
    • Rather than drawing the points, use [geom_smooth()]() to draw a smooth curve for each model.
  • Create a tibble of residuals, named residuals.
    • Call mutate() on both_responses.
    • The new column should be called residual.
    • residual should be equal to the predicted response minus the actual response.
  • Update the residual density plot.
    • Add a color aesthetic to draw each model in a different color.