I am using scikit-learn to build a multiclass classification model. To this extent, I have tried the RandomForestClassifier, KNeighborsClassifier, LogisticRegression, MultinomialNB, and SVC algorithms. I am satisfied with the generated output. However, I do have a question about the default mechanism used by the algorithms for multiclass classification. I read that all scikit-learn classifiers are capable of multiclass classification, but I could not find any information about the default mechanism used by the algorithms.
Asked
Active
Viewed 119 times
-1

desertnaut
- 57,590
- 26
- 140
- 166

Tony P
- 211
- 5
- 12
-
2Some classifiers, like KNeighborsClassifier or RandomForestClassifier are capable of multiclass classification by default. Other, like LogisticRegression, which only capable of saying yes or now, adapt to multiclass by OVR. I do not think such thing as a default "mechanism" exists. – Sergey Bushmanov Oct 22 '20 at 21:14
1 Answers
1
One-vs-the-rest or One-vs-all is the most commonly used and a fair default strategy for multiclass classification algorithms. For each classifier, the class is fitted against all the other classes. Check here for more information https://scikit-learn.org/stable/modules/generated/sklearn.multiclass.OneVsRestClassifier.html

gideon
- 79
- 5
-
How your answer would apply to `KNeighborsClassifier` or `RandomForestClassifier`? – Sergey Bushmanov Oct 22 '20 at 21:10
-
-
Sorry for the stupid question, but what does it mean by "works inherently"? I noticed that the scikit-learn documentation mentioned the same, but did not understand what it means. – Tony P Oct 22 '20 at 21:44
-
It means it supports multiclass natively do not need any extra manipulation or adaptation like OVR – gideon Oct 22 '20 at 22:17