Notebook As simple as it is, I started machine learning course (Ng's Coursera), and here is my implenetation of multivariable gradient descent algorithm in numpy.
That's it , I used numpy matrixes not arrays, to avoid loops and indexing if possible, convergence is tested in the way that two consecutive values of cost function must differ less than 0.00001 - than main loop stops - in this example. This code is not nice, but I really don't see what to remove from it.I, also, don't like this conversion to float in gradient descent loop, but that's how numpy matrixes worked for me. I didn't test it on bigger dataset yet, but for very small input, looks fine:
If cost function is computed correctly (I believe yes), than that algorithm works fine, it's a bit slow for me, but I'm going to go deep into it and will let you know about it for sure! Thanks. Bye!