Multiclass Classification Techniques
So, unfortunately, we live in a world where outcomes (in ML parlance, classes) are not always so polarized: 0 vs. 1, night vs. day, and so on. Therefore, we need techniques for predicting non-binary outcomes. Thankfully, logistic regression can still help us!
In this recipe, we introduce multiclass logistic regression techniques, focusing on one-vs-rest (OvR) (also known as One-vs-All)and multinomial logistic regression strategies. These methods extend binary logistic regression to handle classification problems with more than two classes. We will implement these techniques using scikit-learn, learning how to adapt and apply logistic regression to multiclass datasets.
Getting ready
To get started, we’ll once again utilize a dataset we’ve used before: the Iris dataset. This dataset contains three classes so it’s perfect for this basic illustration of multiclass classification.
Load the libraries:
from sklearn.datasets import load_iris...