Train-Test Split

تقسيم التدريب والاختبار

Definition

Separating the data into a training part and a test part to estimate performance on data the model has not seen.

Definition

A train-test split partitions data into a training portion and a held-out test portion so that generalisation can be estimated on unseen examples.

Practical examples

Code example Python
from sklearn.model_selection import train_test_split

X = list(range(10))
X_tr, X_te = train_test_split(X, test_size=0.2, random_state=0)
print(len(X_tr), len(X_te))

Expected output

8 2

Learn and review

Suggested terms to learn next