Week3 notebook

Why in this notebook, (at the end of the screenshot), why we need reshape(-1,1) on y in the end?

Ask yourself the question what does np.reshape(-1, 1) do?

Thanks for fixing @paulinpaloalto, I appreciate it; sometimes I miss things.

I know what reshape(-1,1) does. But it seems you missed things again why I ask that question. Not what reshape does, but why it is necessary.

Well, it seems to me you have to use some of your intelligence to inquire further; if you are always furnished with the answers, when are you going to become independent in your own thinking?

My purpose here is to help others understand, not to give them answers; you have joined the community recently (you are quite new here and lightly make judgments on others), and I have been here for many years. My way of teaching is to indicate the way you have to go, the path to travel is yours, I can not travel the path for each learner here!

You have to develop skills of questioning the very way you are thinking and try to push yourself to walk the path of learning yourself, that’s my suggestion to you as a mentor.

Ask yourself the question, which part of your reply actually did what you claim to do – “help others understand.” The number of years as a mentor is nothing but a number. It gives no meaning to how experienced or good the mentor is. But people’s feedback does. I suggest you to read other mentors’ reply and learn how they help people find where their confusion is and how they provide a clear clarification/perspective to understand the quesiton, like Raymond’s reply, very intuitive and constructive.

All learners come to this community for knowledge and mutual respect between mentors and learners goes without saying. In case something is missing in your education, it is helpful to know that “to use some of your intelligence to inquire further” is not a respectful comment as a mentor.

No need to continue on this post. But I hope you can move forward with that in mind.

I think reshape is used because it’s a cleaner way to make an np array into a one column array of values instead of a row of values (check the screenshot). You want the y to be one column with x amount of rows because it contains the target values for each row.

2 Likes

Thanks Grimmlen. I usually use Pandas dataframe and the target variable is already a column of values. So it never occurred to me that when we create it from numpy array, we actually need to reshape it from row to column vector. That’s why I was confused of that last operation on y.

1 Like