Introduction of Holdout Method (original) (raw)

Last Updated : 17 Sep, 2025

The Holdout Method is a fundamental validation technique in machine learning used to evaluate the performance of a predictive model. In this method, the available dataset is split into two mutually exclusive subsets:

dataset

Visualizing Holdout Method

This ensures that the model’s evaluation is unbiased and gives an estimate of how well it will generalize to new data.

Working of Holdout Method

The holdout method works by creating separate partitions of data that ensure training and evaluation are performed independently.

Let's see an example:

Here we will use scikit learn library.

from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score, classification_report

iris = load_iris() X = iris.data y = iris.target X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, random_state=42, shuffle=True )

model = DecisionTreeClassifier(random_state=42)

model.fit(X_train, y_train)

y_pred = model.predict(X_test)

accuracy = accuracy_score(y_test, y_pred)

print("Accuracy on Test Set:", accuracy) print("\nClassification Report:\n", classification_report( y_test, y_pred, target_names=iris.target_names))

`

**Output:

Screenshot-2025-09-15-153905

Output

Application

Advantages

Limitations