Multinomial logistic regression
Logistic regression would not be as useful if it only worked for binary classification problems. Fortunately, we can use multinomial logistic regression when our target has more than two values.
In this section, we will work with data on machine failures as a function of air and process temperature, torque, and rotational speed.
Note
This dataset on machine failure is available for public use at https://www.kaggle.com/datasets/shivamb/machine-predictive-maintenance-classification. There are 10,000 observations, 12 features, and two possible targets. One is binary – that is, the machine failed or didn’t. The other has types of failure. The instances in this dataset are synthetic, generated by a process designed to mimic machine failure rates and causes.
Let’s learn how to use multinomial logistic regression to model machine failure:
- First, we will import the now-familiar libraries. We will also import
cross_validate...