O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performing k-fold cross-validation

The R implementation of some techniques, such as classification and regression trees, performs cross-validation out of the box to aid in model selection and to avoid overfitting. However, some others do not. When faced with several choices of machine learning methods for a particular problem, we can use the standard approach of partitioning the data into training and test sets and select them based on the results. However, cross-validation gives a more thorough evaluation of a model's performance on holdout data. Comparing the performance of methods using cross-validation can paint a truer picture of their relative performance.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required