aapatel09 / handson-unsupervised-learning

Code for Hands-on Unsupervised Learning Using Python (O'Reilly Media)
650 stars 324 forks source link

Unnecessary complexity (I think) #32

Open cgosorio opened 2 years ago

cgosorio commented 2 years ago

I do not know if this is an issue of the code, or just the consequence of my limited understanding of what is going on in a piece of code. In the notebook 02_end_to_end_machine_learning_project.ipynb, why the for loop is like this in the section about logistic regression:

for train_index, cv_index in k_fold.split(np.zeros(len(X_train)), y_train.ravel()):

Instead of just

for train_index, cv_index in k_fold.split(X_train, y_train):

What is behind that np.zeros and the call to the method ravel()?

If there is no reason for doing it the way it is done, I think the simpler version would be better, given that this is code to teach people how to use scikitlearn library.