reset password
Author Message
jyoung18
Posts: 30
Posted 09:09 Feb 06, 2015 |

So I've got the cost function working but the gradient descent function is a bit confusing.

I loop through the Y array and calculate the prediction for that value of x

I take the prediction -

prediction = alpha * 1 / N * (prediction - x_val)

I then take theta and assign it to a temp vector

Temp[0] = Theta[0] - prediction[0]

Temp[1] = Theta[1] - prediction[1]

Then reassign theta to the temp values.

I'm not sure what I'm doing wrong here.

msargent
Posts: 519
Posted 13:01 Feb 06, 2015 |

The prediction is simply 1(theta0) + x1(theta1) = y.