# Optimize classification rule in multinomial logistic regression

We know that in the case of logistic regression, a classification threshold p=0.5 is generally not an optimal choice when seeking to optimise sensitivity and specificity. This is generally due to the fact that the dataset is unbalanced. To solve this problem, one can simply vary the threshold and take the one that verifies a certain criterion (e.g. that maximises sensitivity+specificity, or such that sensitivity=specificity etc.).

However, in the case of multinomial logistic regression (with 3 or more classes), I find much less literature on the subject to determine robust decision rules. All software I know does a classification using a maximum a posteriori, but I am not satisfied with this solution, in the same way that p=0.5 is rarely satisfactory in the binary case. I imagine it is much more difficult with 3 or more classes, as one can put more emphasis on the sensitivity/specificity to a particular class where it was not an issue in the 2 class case.

So let's say I have 3 classes (or N classes), with an unbalanced dataset, and I don't favour any class (i.e I give equal weight to sensitivity and specificity for each class), how should I make my decision from the posterior probabilities returned by the multinomial logistic regression?

• +1 but what are "positives" and "negatives" when you have $3+$ classes?
– Dave
May 16, 2022 at 13:50
• @Dave This is indeed unclear in my post. I should not use these terms to avoid confusion. I edited the original post. May 16, 2022 at 14:45
• In order to "optimize" a decision rule you need to specify some objective/cost function (e.g. what are the costs of false negatives/positives etc.). Those depend on your specific use case or goals, so, since you didn't specify any, it is impossible to answer the question. (Also note that you wrote sensitivity+sensitivity several times, I assume you meant specificity) May 19, 2022 at 11:17
• @J.Delaney It sounds like, in the last paragraph, all mistakes incur equal cost.
– Dave
May 19, 2022 at 11:17
• @Dave presumably one of the possible decisions is not to assign any class at all when the model probabilities are not conclusive, namely to avoid mistakes at the cost of reduced sensitivity May 19, 2022 at 11:46

Let the risk of classifying pattern $$x$$ as belonging to class $$i$$ be
$$R(C_i|x) = \sum_{c=1}^CL_{ij}P(C_j|x)$$
Where $$L_{ij}$$ is the penalty (loss) suffered when classifying a pattern as belonging to class $$i$$ when it actually belongs to class $$j$$. Simply classify the pattern as belonging to the class that minimises the risk. That is the equivalent procedure for multiple classes.