I am new to numpy, and I'm already a little sick of its syntax.
Something which could be written like this in Octave/matlab
1/(2*m) * (X * theta - y)' * (X*theta -y)
Becomes this in numpy
np.true_divide(((X.dot(theta)-y).transpose()).dot((X.dot(theta)-y)),2*m)
This is much harder for me to write and debug. Is there any better way to write matrix operations like above so as to make life easier?
X*theta - yseparately and using the value twice instead of recomputing it.numpyis just a package in a general use programming language. So it's no surprise that its syntax is not as "mathematical" as matlab...*has to mean either elementwise multiplication or matrix multiplication, and for numpy arrays they decided to make it mean the former.)