LoslegenKostenlos loslegen

Evaluate model performance

Now that you have both the actual and predicted values of each fold you can compare them to measure performance.

For this regression model, you will measure the Mean Absolute Error (MAE) between these two vectors. This value tells you the average difference between the actual and predicted values.

Diese Übung ist Teil des Kurses

Machine Learning in the Tidyverse

Kurs anzeigen

Anleitung zur Übung

  • Calculate the MAE by comparing the actual with the predicted values for the validate data and assign it to the validate_mae column.
  • Print the validate_mae column (note how they vary).
  • Calculate the mean of this column.

Interaktive Übung

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

library(Metrics)
# Calculate the mean absolute error for each validate fold       
cv_eval_lm <- cv_prep_lm %>% 
  mutate(validate_mae = map2_dbl(___, ___, ~mae(actual = .x, predicted = .y)))

# Print the validate_mae column
cv_eval_lm$___

# Calculate the mean of validate_mae column
___
Code bearbeiten und ausführen