Logistic regression doubt

In logistic regression, do why do we calculate cost for each training example while we calculate the gradient for each feature by going through the j loop as well ?

The cost tells you how well the model fits the data.

The gradients tell you how to update the weights so the model fits better (and reduces the cost).

2 Likes

Thanks for the clarification.