This question already has an answer here:

For logistic regression, the loss function is convex or not? Andrew Ng of Coursera said it is convex but in NPTEL it is said is said it is non convex because there is no unique solution. (many possible classifying line)


marked as duplicate by Sycorax, Michael Chernick, user158565, Jeremy Miles, Frans Rodenburg Jun 14 at 6:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


I don't think anybody claimed that it isn't convex, since it is convex (maybe they meant logistic function or neural networks). Let's check 1D version for simplicity

$$L = - t \log(p) + (1 - t) \log(1-p)$$

Where $p = \frac{1}{1 + \exp(-wx)}$

$t$ is target, $x$ is input, and $w$ denotes weights.

L is twice differentiable with respect to $w$ and $\frac{d}{dw^2} L = \frac{x^2 \exp(wx)}{(1 + \exp(wx))^2} > 0$, so the loss function is convex.


Not the answer you're looking for? Browse other questions tagged or ask your own question.