End-to-End ML Project- Beginner friendly

49 / 95

Create an object of StratifiedShuffleSplit

So, as StratifiedShuffleSplit is a class, we will first need to create an object of it. The syntax of creating an object in Python is-

obj_name = Class_name(parameters)

You can refer to Python classes and objects to understand classed and object better.


Create an object of class StratifiedShuffleSplit of name split_object with parameters specified as-

  1. n_splits = 1 - We specify it as 1 because we don;t want to perform cross validation here. We only want to perform stratified split.
  2. test_size = 0.2 - To split our dataset in a 80:20 train:test ratio.
  3. random_state = 42- 42 is chosen arbitrarily.

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...