LoslegenKostenlos loslegen

Evaluate the folds

Now that you fit 10 models using all 10 of your folds and calculated the MAE and RMSE of each of these models, it's time to visualize how large the errors are. This way, you build an intuition of the out-of-sample error distribution, which is helpful in assessing your model quality.

You will plot all these errors as a histogram and display the summary statistics across all folds.

The result of the previous exercise, fits_cv, is pre-loaded.

Diese Übung ist Teil des Kurses

Machine Learning with Tree-Based Models in R

Kurs anzeigen

Anleitung zur Übung

  • Collect the out-of-sample errors of all models of fits_cv using a single yardstick function and save them as all_errors.
  • Create a ggplot2 histogram using the .estimate as the x aesthetic and fill the bars by .metric.
  • Use the same function as in the first instruction with summarize = TRUE to display summary statistics of fits_cv.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

library(ggplot2)

# Collect the errors
all_errors <- ___(___, summarize = ___)

# Plot an error histogram
ggplot(___, aes(___, ___)) +
        ___()

# Collect and print error statistics
___(fits_cv, ___)
Code bearbeiten und ausführen