AI Terms Dictionary

A comprehensive multilingual AI terminology dictionary

Definition

Leave-one-out cross-validation (LOOCV) is a specific case of k-fold cross-validation where k equals the number of samples in the dataset. It provides a nearly unbiased estimate of model performance because each observation serves as the test set exactly once. While computationally expensive due to the need to train the model n times, it is highly effective for small datasets where maximizing training data usage is critical for robust evaluation.

Summary

A rigorous resampling technique where the model is trained on all but one sample and tested on that single held-out sample, repeated for every data point.

Key Concepts

Use Cases

Code Example

1
2
3
4
5
6
7
from sklearn.model_selection import LeaveOneOut
loo = LeaveOneOut()
for train_index, test_index in loo.split(X):
    X_train, X_test = X[train_index], X[test_index]
    y_train, y_test = y[train_index], y[test_index]
    model.fit(X_train, y_train)
    score = model.score(X_test, y_test)