C1_W3_Logistic_Regression - how does the code define y_train

Hi folks

Re: Week 3 Practice Lab - Logistic Regression

This is a really basic question, but what part of the code is defining that y_train is the third column in the data set file ex2data1.txt?

We have

X_train, y_train = load_data(“data/ex2data1.txt”)

Does Python simply know that the y data is the final column?

Thanks

Hello, @Lynton,

To find out, we can go to the source code of load_data which can be accessed via “File” > “Open” > “utils.py” and we see that we have coded to take the third column as y!

image

Cheers,
Raymond

1 Like

Thanks Raymond, I missed that! Greatly appreciated.

Thanks

1 Like

No problem, @Lynton!