References :
- Pattern Recognition and Machine Learning by Bishop [Page no 244]
- Andrew NG’s course by deeplearning.ai
- https://sudeepraja.github.io/Neural/
References :
In the blog post on Cost Function And Hypothesis for LR we noted that LR (Logistic Regression) inherently models binary classification. Here we will describe two approaches used to extend it for multiclass classification.
One vs Rest approach takes one class as positive and rest all as negative and trains the classifier. So for the data having n-classes it trains n classifiers. Now in the scoring phase all the n-classifier predicts probability of particular class and class with highest probability is selected.
One vs One considers each binary pair of classes and trains classifier on subset of data containing those classes. So it trains total n*(n-1)/2 classes. During the classification phases each classifier predicts one class. (This is contrast to one vs rest where each classifier predicts probability). And the class which has been predicted most is the answer.
For example consider four class problem having classes A, B, C, and D.
One vs Rest
One vs One