AI用語辞典

A comprehensive multilingual AI terminology dictionary

Definition

留一法交差検証(LOOCV)は、kの値がデータセット内のサンプル数と等しいk-fold交差検証の特殊なケースです。これはモデル性能のほぼ不偏な推定値を提供します。

Summary

モデルを1つのサンプルを除くすべてのデータで学習し、その1つを残してテストする厳密なリサンプリング手法であり、このプロセスを各データポイントに対して繰り返す。

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)