Contents
Cross-Validation/Chapter 07 of 09
07Common misconceptions
- “Cross-validation produces the final model.” It produces scores. The MK fold models are thrown away, and the chosen setting is refit once on all the training data (Murphy, 2022, eq. 4.105).
- “The best cross-validation score is the accuracy to expect.” It is the maximum of noisy estimates and therefore optimistic (Varma and Simon, 2006; Cawley and Talbot, 2010). Report a locked test set or nested cross-validation.
- “The validation set and the test set are the same thing.” The validation folds choose; the test set assesses, once. A test set used to choose becomes a validation set (Hastie et al., 2009, §7.2).
- “Leave-one-out is always best.” It costs N trainings (except for least squares, Proposition 3), its estimate can be highly variable, and it can fail outright: 0\% for a majority-class classifier that is right a third of the time (Kohavi, 1995). Five or ten folds are the usual choice.
- “Preprocessing on the whole data set is harmless.” Supervised selection on the whole data set turned pure noise into 1\% error (Figure 6). Every step that learns from data belongs inside the folds.
- “A random split works for any data.” Not when rows are grouped (patients, users) or ordered in time; split by group, or train on the past and validate on the future.
- “Cross-validation estimates the error of my fitted model.” It estimates the average error of the procedure over training sets of a similar size, which is a property of the recipe more than of the particular model fitted to your data (Hastie et al., 2009, §7.12).