I'm fairly new to linear algebra and I'm currently taking Andrew Ng's machine learning course. I'm struggling to understand how the two below functions are the same. I'm working on vectorizing gradient descent for linear/logistic regression.
theta = theta - (alpha/m)*(X')*(X*theta - y)
theta = theta - (alpha/m)*sum((X*theta -y)*x(i))
My thought is that x(i)
is a vector and in order to do vector multiplication, I need to transpose it, but when trying to mock up an example I didn't see how that was necessary. Any help or explanation would be greatly appreciated.
x(i)
. Please edit your question to make sure all code is correct. – Cris Luengoalpha
,m
,theta
,y
,x
, andX
are in this particular case). Restate your question by stating what the variables are exactly, and far more importantly, their dimensions, and chances are the answer will pop up by itself. – Tasos Papastylianou