Menu

Splitting the Dataset

Splitting the Dataset

Divide the dataset into training and testing sets.

Code

X_train, X_test, Y_train, Y_test = train_test_split(
X,
Y,
test_size=0.25,
random_state=44
)

Explanation

The dataset is divided into:

  • 75% Training Data
  • 25% Testing Data

The random_state parameter ensures consistent results across multiple runs.