Week 2 Assignment : First 5 labels of Training

How can we define in advance what would be the first 5 labels of training data? We split the training and test data randomly from the main data set by using random.sample(). everytime. I Execute the function it will generate a different values of the training and validation data. I think this guidance below is incorrect. Any thoughts?

First 5 labels of the training set should look like this:

Well, I changed the code to just slice without randomly generating the indexes for test data. And. it works.

Typically the assignments will force an initial seed value for the random number generator function, so it will always give the same sequence of values.

1 Like