cross-validation
-
What is cross-validation in computer science?
Cross-validation is a data resampling technique in machine learning that assesses how well predictive models perform. It gauges a model's predictive capability by testing its generalizability using different portions of a dataset.
The most common type is k-fold cross-validation, where data is randomly separated into k sets (or folds) of roughly equal size. One of the k folds is set aside as the assessment set, while the remaining folds are the analysis set. This process repeats k times, with each fold being used as the analysis set, and the final performance statistic is calculated by averaging the k-calculated test statistics. Other types include Monte Carlo cross-validation and leave-one-out cross-validation.
1 Britannica SourceCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
Why is cross-validation used when training computer models?
Cross-validation is a data resampling technique in machine learning used to evaluate how well predictive models generalize to new, unseen data. It helps in assessing a model's predictive capability by testing it on different portions of a dataset.
The process involves dividing the data into training and testing sets. The training set is further split into analysis and assessment sets. The model is trained on the analysis set and tested on the assessment set to estimate its predictive capacity. This process is repeated multiple times with variations to the analysis set, and the results are averaged to determine the model's overall predictive performance. Common techniques include k-fold cross-validation, leave-one-out cross-validation, and Monte Carlo cross-validation.
1 Britannica SourceCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
How does basic cross-validation work?
Cross-validation is a resampling method in machine learning used to assess how well predictive models perform. It works by testing the modelās ability to generalize to new data using different portions of a dataset.
In basic cross-validation, the original dataset is split into two parts: a training set and a testing set. The model learns from the training set and is then evaluated on the testing set to estimate its accuracy on unseen data. To refine the model, the training set is further divided into analysis and assessment sets. The model is trained on the analysis set and tested on the assessment set to estimate its predictive capabilities. This process is repeated multiple times, and the results are averaged to determine the model's overall performance. The most common type of cross-validation is k-fold cross-validation.
1 Britannica SourceCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
What is 'k-fold' cross-validation?
In machine learning, cross-validation is a data resampling method used to test how well predictive models perform.
K-fold cross-validation is a common type where data is randomly divided into k sets (folds) of roughly equal size. In each iteration, one of the k folds is the assessment set, while the remaining k-1 folds form the analysis set. This process repeats k times, using each fold as the assessment set. The final performance statistic is the average of the k-calculated test statistics. A standard practice is to set k = 10.
1 Britannica SourceCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
How does cross-validation help prevent overfitting in models?
Cross-validation helps prevent overfitting by assessing how well a model generalizes to new, unseen data. In this technique, the dataset is split into training and testing sets. The training set is further divided into analysis and assessment sets. The model is trained on the analysis set and evaluated on the assessment set to estimate its predictive performance.
The most common type is k-fold cross-validation, where data is divided into k sets or folds. Each fold serves as the assessment set in one iteration, with the remaining folds used for analysis. The final performance is the average of the k test statistics. This process is repeated with variations to the analysis set multiple times, and the statistics are averaged to estimate the model's overall predictive performance.
1 Britannica SourceCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
What are some common variations of cross-validation and when are they used?
Cross-validation is a data resampling technique in machine learning used to evaluate how well predictive models perform. It tests a modelās ability to generalize to new data using different portions of a dataset. Common types include:
-
k-fold cross-validation: The data is randomly divided into k sets (folds). In each iteration, one fold is used for assessment, and the remaining k-1 folds are used for analysis. This is repeated k times, and the results are averaged. A standard choice is k=10.
-
Monte Carlo cross-validation: Randomly allocates a proportion of data to assessment and analysis sets across iterations. The sets aren't mutually exclusive, and some data points may never be included.
-
Leave-one-out cross-validation (LOOCV): A special case of k-fold cross-validation where k equals the number of data points. Each data point is used once as the assessment set. LOOCV is less useful than other methods due to high computational cost and large variances, except for very small datasets.
1 Britannica SourceCreated from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles. -
cross-validation, data resampling technique used in machine learning to evaluate the performance of predictive models. Cross-validation is used to assess a modelās predictive capability by testing its generalizability with different portions of a dataset. Cross-validation is one of the most common types of data resampling and encompasses a variety of techniques, including k-fold cross-validation, leave-one-out cross-validation, and Monte Carlo cross-validation.
Motivations and mechanisms
Cross-validation is a resampling technique, a method in which new samples are created from an original sample, that is mainly used in the model-building stage of machine-learning. For prediction-based problems, the goal is to create a model that can predict future outcomes, such as a stockās price or a surgeryās success. Such algorithms are created by generating a model based on patterns in data from previous situations.
However, it is crucial to maintain the balance between a model that accurately captures the relationships evident in past data and one that can also generalize to new, unseen data. If the model is too closely adapted to the training data, it is said to be āoverfitā and will not be accurate in future predictions. By contrast, if the model overly ignores small trends in the data, it may miss important causal relationships and āunderfitā the data. Typically, this balance is tested by splitting the data into two sets: the training set, which comprises the data used to inform the model, and the testing set, which is used to assess how accurately the model would perform on future data. It is important to measure a modelās predictive performance using data different from what was used to create it; otherwise estimates of its predictive capacity would be overinflated, since the model has already used the data.
Typically, the testing set can be used only to assess a single model, thereby preserving the setās āunseenā status. This can present obstacles, as many model types rely on choices of parameter values that can significantly affect accuracy. Before valuable data are spent evaluating the final modelās performance, it is useful to consider estimates of which models may perform better than others. Cross-validation can provide such estimates and allow researchers to test potential model variations before a final model is chosen.
The fundamental principle of cross-validation is based on a process similar to the initial split of the data into training and testing sets. In cross-validation, the training set is further divided into the analysis set, where observations are used to train potential models, and the assessment set, where observations are used to test the modelsā predictive abilities. In general, a model is fit to the analysis set and tested using the assessment set, producing a test statistic estimating the modelās predictive capacity. Depending on the type of cross-validation, this process is typically repeated with some variation to the analysis set a certain number of times, and the collection of the statistics are averaged to generate a given modelās overall predictive performance metric.
Types of cross-validation
The most common type of cross-validation is k-fold cross validation. In this process, the data are randomly separated into a number, k, of sets, called folds, of roughly equal size. During a single iteration, one of the k folds is set aside as the assessment set, while the remaining kā1 folds are the analysis set. This process is repeated k times, with each fold being used as the analysis set, and the final performance statistic is calculated by averaging the k-calculated test statistics. For example, when k = 3, the first two folds act as the analysis set, while the final fold is set aside as the assessment set. The process would be repeated twice, with the remaining two folds acting as the assessment set in their respective iterations. A trade-off exists when choosing the appropriate number of folds, as larger values of k result in smaller bias but larger variance. Generally, k = 3 would not substantially reduce bias; instead, k = 10 is typically considered the standard number of folds.
Similar to k-fold cross-validation, Monte Carlo cross-validation allocates a specified proportion of data to the assessment and analysis sets across each iteration. However, the composition of these sets is randomly selected each time, resulting in sets that are not mutually exclusive. Observations in the assessment set of one iteration may also be included in the assessment sets of other iterations as well, while other data points may never be included at all.
A less common method is leave-one-out cross-validation (LOOCV). A special variation of k-fold cross-validation, LOOCV occurs when the number of folds (k) is equal to the number of sample points (n). In each iteration of testing, a single data point will be left out and function as the assessment set. The process is repeated for all n observations, and the k results are averaged to produce the overall performance statistic. However, high computational cost and large variances almost always make LOOCV less useful than other types of cross-validation, except for datasets with a very small n.

" height="20" alt="HEW Logo">