# Multi-Class Classification

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).

<figure><img src="https://1787839673-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM1gGqj8SpSFcWdTifH2Y%2Fuploads%2FAtuDrfB1x9sukz5BfMYu%2Fa.png?alt=media&#x26;token=347809d3-ee46-4b7b-a1a1-531881864f74" alt=""><figcaption></figcaption></figure>

## One-Vs-Rest (One-Vs-All)

It involves splitting the multi-class dataset into multiple binary classification problems. A binary classifier is then trained on each binary classification problem and predictions are made using the model that is the most confident.

* Binary Classification Problem 1: red vs \[blue, green]
* Binary Classification Problem 2: blue vs \[red, green]
* Binary Classification Problem 3: green vs \[red, blue]

## One-Vs-One

The formula for calculating the number of binary datasets, and in turn, models, is as follows: $$(NumClasses * (NumClasses-1)) / 2$$ Each binary classification model may predict one class label, and the model with the most predictions or votes is predicted by the one-vs-one strategy.

* Binary Classification Problem 1: red vs. blue
* Binary Classification Problem 2: red vs. green
* Binary Classification Problem 3: red vs. yellow
* Binary Classification Problem 4: blue vs. green
* Binary Classification Problem 5: blue vs. yellow
* Binary Classification Problem 6: green vs. yellow
