ArticleslgStudy

mathematics

Multiclass classification

Multiclass classification is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Multiclass classification rather than just read about it. In short: 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…

Key takeaways

  • Multiclass classification belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Multiclass classification to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Multiclass classification from memory before moving on to harder problems.

Reference excerpt

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.

Worked examples

Example 1 — a first encounter with Multiclass classification

Start with the simplest possible case. Write down what Multiclass classification claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Multiclass classification before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Multiclass classification ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Multiclass classification

In research
Multiclass classification appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Multiclass classification in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Multiclass classification is common in secondary-school and first-year university syllabi. It links to neighbouring topics Classification algorithms, Statistical classification, so understanding it makes those chapters shorter.
In everyday life
Look for Multiclass classification outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Multiclass classification” →

How to study Multiclass classification in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Multiclass classification means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Multiclass classification out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Multiclass classification in simple terms?

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…

Why does Multiclass classification matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Multiclass classification?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Multiclass classification.

Tags

  • Classification algorithms
  • Statistical classification

Keep exploring