- #1
jjstuart79
- 7
- 0
Hi,
I am studying logistic regression and gradient ascent and have seen it used with a cost function and without one. Could anyone tell me why you would use a cost function? It seems just as effective without one.
alpha = .05
h = data * weights
error = labels - sigmoid(h)
weights = weights + alpha * data * error
At this point I would think I can just loop through the above code and break when "error" converges. However, I've also seen code where you would pass "weights" to a cost function and break when the cost function converges. Please let me know if you need more information from me. Thanks
I am studying logistic regression and gradient ascent and have seen it used with a cost function and without one. Could anyone tell me why you would use a cost function? It seems just as effective without one.
alpha = .05
h = data * weights
error = labels - sigmoid(h)
weights = weights + alpha * data * error
At this point I would think I can just loop through the above code and break when "error" converges. However, I've also seen code where you would pass "weights" to a cost function and break when the cost function converges. Please let me know if you need more information from me. Thanks