How is this working?

This is from the previous video.

When we multiply a*b ,its element wise multiplication…so sir found theta=np.linalg.pinv(firstpart)*secondpart…which should have performed element wise multiplication but surprisingly it gave the correct result?How?

It should have been np.dot( np.linalg.pinv(firstpart),secondpart)…Please let me know what is wrong in what I am thinking?

1 Like

Hey @nikhil_sarda, you are completely right, it should be np.dot, but you forgot one thing, that '*" do element wise multiplication in case both operators are numpy.ndarray.

But here, we used

   Y = np.mat(Y)

So by this we converted secondPart to <class ‘numpy.matrix’> and now * will perform dot product only.

If you decide not to use this line, you have to use np.dot().

Hope this cleared your doubt.
Plz mark the doubt as resolved in my doubts section.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.