course content

Course Content

Python for Data Science: Identifying Email Threats

Train-Test SplitTrain-Test Split

The train-test split is a method used in machine learning to divide a dataset into two parts: a training set and a test set.

The training set is used to train a model, while the test set is used to evaluate the model's performance. It is important because it allows the model to be evaluated on unseen data, which helps to prevent overfitting.

Overfitting occurs when a model is trained too well on the training data and performs poorly on unseen data. By evaluating the model on a test set, we can better understand how the model will perform in the real world.

It also allows us to better understand the model's performance and generalization power and tune the model's hyperparameters by comparing the performance on the different test sets.


  1. Import the train_test_split module;
  2. Use it to partition the newly created X and y variables.

Mark tasks as Completed

Everything was clear?

Section 1. Chapter 8