Hi,(adsbygoogle = window.adsbygoogle || []).push({});

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

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Logistic Regression Cost Function

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**