reset password
Author Message
ZachTapia
Posts: 3
Posted 11:18 Nov 21, 2019 |

Do we also have to: resample(y_train, n_samples = bootstrap_size, random_state = i, replace = True) just like we did to X_train?

If I don't do this step then I get an error when I try to train my model because the sizes of my new, smaller X_train doesn't match the older, bigger y_train.

Thanks, Zach

dtang9
Posts: 52
Posted 12:09 Nov 21, 2019 |

Yes. That's what the professor said in the email he sent to everyone.

mpourhoma
Posts: 39
Posted 12:24 Nov 21, 2019 |

Yes, please see the email that I sent on Saturday:

 

In question 1-d, when you train your 19 classifiers, in each round you train the model with new selected samples and their corresponding labels!

To do that you have to resample the labels with the same random_state to make sure that the samples match with the labels. Like this:

for i in range(19):

    X_train_i = resample(X_train, n_samples = X_train_Sample_size , random_state=i , replace = True)

    y_train_i = resample(y_train, n_samples = X_train_Sample_size , random_state=i , replace = True)

Or Equivalently:

for i in range(19):

    X_train_i , y_train_i = resample(X_train, y_train, n_samples = X_train_Sample_size , random_state=i , replace = True)