November 2017
Intermediate to advanced
1035 pages
11h 31m
English
In this recipe, we'll look at multiclass classification. Depending on your choice of algorithm, you either get multiclass classification for free, or you have to define a scheme for comparison.
When working with linear models such as logistic regression, we need to use OneVsRestClassifier. This scheme will create a classifier for each class.
First, we'll walk through a cursory example of a Decision Tree fitting a multiclass dataset. Like we discussed earlier, we get multiclass for free with some classifiers, so we'll just fit the example to prove that it works, and move on.
Second, we'll actually incorporate OneVsRestClassifier into our model:
>>> from sklearn import datasetsRead now
Unlock full access