In machine learning and statistical classification, multiclass classification or multinomial classification is the problem of classifying instances into one of three or more classes (classifying instances into one of two classes is called binary classification). For example, deciding on whether an image is showing a banana, peach, orange, or an apple is a multiclass classification problem, with four possible classes (banana, peach, orange, apple), while deciding on whether an image contains an apple or not is a binary classification problem (with the two possible classes being: apple, no apple). While many classification algorithms (e.g., decision trees, k-NN, neural networks and multinomial logistic regression) naturally permit the use of more than two classes, some are by nature binary algorithms (e.g., classical binary support vector machine) and require decomposition strategies such as one-vs-all, one-vs-one, or error-correcting output codes (ECOC) to solve multiclass problems. Multiclass classification should not be confused with multi-label classification, where multiple labels are to be predicted for each instance (e.g., predicting that an image contains both an apple and an orange, in the previous example).
Better-than-random multiclass models From the confusion matrix of a multiclass model, we can determine whether a model does better than chance. Let K≥3 be the number of classes, 𝒪 a set of observations, ŷ:𝒪→{1,...,K} a model of the target variable y:𝒪→{1,...,K} and ni,j be the number of observations in the set {y=i}∩{ŷ=j}. We note ni.=∑jni,j, n.j=∑ini,j, n=∑jn.j=∑ini., λi=ni.n and μj=n.jn. It is assumed that the confusion matrix (ni,j)i,j contains at least one non-zero entry in each row, that is λi>0 for any i. Finally we call "normalized confusion matrix" the matrix of conditional probabilities (ℙ(ŷ=j∣y=i))i,j=(ni,jni.)i,j.
Intuitive explanation The lift is a way of measuring the deviation from independence of two events A and B : Lift(A,B)=ℙ(A∩B)ℙ(A)ℙ(B)=ℙ(A∣B)ℙ(A)=ℙ(B∣A)ℙ(B) We have Lift(A,B)>1 if and only if events A and B occur simultaneously with a greater probability than if they were independent. In other words, if one of the two events occurs, the probability of observing the other event increases. A first condition to satisfy is to have Lift(y=i,ŷ=i)≥1 for any i. And the quality of a model (better or worse than chance) does not change if we over- or undersample the dataset, that is if we multiply each row Ri of the confusion matrix by a constant ci. Thus the second condition is that the necessary and sufficient conditions for doing better than chance need only depend on the normalized confusion matrix. The condition on lifts can be reformulated with One versus Rest binary models : for any i, we define the binary target variable yi which is the indicator of event {y=i}, and the binary model ŷi of yi which is the indicator of event {ŷ=i}. Each of the ŷi models is a "One versus Rest" model. Lift(y=i,ŷ=i) only depends on the events {y=i} and {ŷ=i}, so merging or not merging the other classes doesn't change its value. We therefore have Lift(y=i,ŷ=i)=Lift(yi=1,ŷi=1) and the first condition is that all binary One versus Rest models are better than chance.
Example If K=2 and 2 is the class of interest , the normalized confusion matrix is (specificity1−specificity1−sensitivitysensitivity) and we have Lift(y=1,ŷ=1)−1=ℙ(y=ŷ=1)λ1μ1−1=n1,1nn1.n.1−1 =n1,1(n1,1+n1,2+n2,1+n2,2)−(n1,1+n1,2)(n1,1+n2,1)n1.n.1=n1,1n2,2−n1,2n2,1n1.n.1. Thus Lift(y=1,ŷ=1)≥1⟺n1,1n2,2−n1,2n2,1≥0. Similarly, by swapping the roles of 1 and 2, we find that Lift(y=2,ŷ=2)≥1⟺n1,1n2,2−n1,2n2,1≥0. Dividing by n1.n2. we find that the necessary and sufficient condition on the normalized confusion matrix is sensitivity specificity−(1−sensitivity)(1−specificity)≥0⟺sensitivity+specificity−1≥0⟺J≥0. This brings us back to the classical binary condition: Youden's J must be positive (or zero for random models).
Random models A random model is a model that is independent of the target variable. This property is easily reformulated with the confusion matrix.
This proposition shows that the model ŷ of y is uninformative if and only if there are two families of numbers (αi)i and (βj)j such that ℙ({y=i}∩{ŷ=j})=αiβj for any i and j.
Multiclass likelihood ratios and diagnostic odds ratios We define generalized likelihood ratios calculated from the normalized confusion matrix: for any i and j≠i, let LRi,j=ℙ(ŷ=j∣y=j)ℙ(ŷ=j∣y=i). When K=2, if 2 is the class of interest,, we find the classical likelihood ratios LR1,2=LR+ and LR2,1=1LR−. Multiclass diagnostic odds ratios can also be defined using the formula DORi,j=DORj,i=LRi,jLRj,i=ni,inj,jni,jnj,i=ℙ(ŷ=j∣y=j)/ℙ(ŷ=i∣y=j)ℙ(ŷ=j∣y=i)/ℙ(ŷ=i∣y=i)
We saw above that a better-than-chance model (or a random model) must verify Lift(y=i,ŷ=i)≥1 for any i and λi. According to the previous corollary, likelihood ratios are thus greater than or equal to 1. Conversely, if the likelihood ratios are greater than or equal to 1, the theorem shows that we have Lift(y=i,ŷ=i)≥1 for any i and λi.
Definition of better-than-chance multiclass models A model ŷ of y outperforms chance if the following conditions are met:
For any j, we have maxiℙ(ŷ=j∣y=i)=ℙ(ŷ=j∣y=j). There are i and j distinct such that ℙ(ŷ=j∣y=i)<ℙ(ŷ=j∣y=j). If all the entries of the confusion matrix are non-zero, this means that all the likelihood ratios are greater than or equal to 1, and at least one of these inegalities is strict. A model that satisfies the first condition but not the second is random, since we then have ℙ({ŷ=j}∩{y=i})=ℙ(y=i)ℙ(ŷ=j∣y=i)=ℙ(y=i)ℙ(ŷ=j∣y=j)=αiβj for any i and j. We can rewrite the first condition in a more familiar way, noting x the observed value of ŷ, θ the value to be estimated of y and θ̂(x) the set argmaxθℙ(x∣θ): for any x we have x∈θ̂(x). We deduce that a model is better-than-random or random if and only if it is a maximum likelihood estimator of the target variable.
Applications
Multiclass balanced accuracy The performance of a better-than-chance model can be estimated using multiclass versions of metrics such as balanced accuracy or Youden's J.
… excerpt ends here. Continue reading the full article.