Number of coefficients and intercepts in sklearn logistic regression I noticed that the matrix of coefficients learned by a logistic regression
model (which can be retrieved with the .coef_ attribute) is $(c, n)$
where $n$ is the number of features (i.e. the number of columns in the
X that you passed to the .fit function), and $c$ is the number classes
(i.e. the number of unique values in the y you passed to the .fit function).
The number of intercepts will just be $c$, except if there are only two
unique values in y, in which case there will only be one intercept.
Can someone please explain how these numbers make sense? To begin with, how
could there a matrix of coefficients on a single logistic regression
model?

The library creates $c$ neurons for $c$ classes for $c>2$, which yields $c\times f$ coefficients and $c$ biases, where $f$ is the number of features. So, it's like a collection of logistic regressions, or like a single layer neural network.
