reset password
Author Message
ljuster2
Posts: 19
Posted 08:31 Feb 02, 2015 |

When I calculated initial cost = (1/2*m) * sum (prediction - actual)^2

I got 239305.74 = sum (prediction - actual)^2

and 

.00127551020408 =  (1/2*m)

multiplied together I got 305.236, which is very different from your  119652.7 

 

Am I doing something wrong, or did you perhaps initialize theta to something other than [0,0] ? 

 

Thanks

 

msargent
Posts: 519
Posted 09:12 Feb 02, 2015 |

I initialized with zeros. I'll check into it.

msargent
Posts: 519
Posted 09:28 Feb 02, 2015 |

There was a mistake on the pdf: it reflected values of an old version. Here are the corrected values: 

Cost before gradient descent:  305.236913265

Thetas:  [[ 23.44490618]
 [ -6.48710167]]
Cost after gradient descent:  9.33830885019

Apologies for any inconvenience.