Import Required Libraries
Python libraries make it very easy for us to handle the data and perform typical and complex tasks with a single line of code.
- Matplotlib/Seaborn – This library is used to draw visualisations.
- Sklearn – This module contains multiple libraries having pre-implemented functions to perform tasks from data preprocessing to model development and evaluation.
Python3
from sklearn.preprocessing import label_binarize from sklearn.model_selection import train_test_split from sklearn.multiclass import OneVsRestClassifier from sklearn.metrics import roc_curve, auc, RocCurveDisplay from sklearn.linear_model import LogisticRegression from sklearn import datasets from itertools import cycle import matplotlib.pyplot as plt |
Multiclass Receiver Operating Characteristic (roc) in Scikit Learn
The ROC curve is used to measure the performance of classification models. It shows the relationship between the true positive rate and the false positive rate. The ROC curve is used to compute the AUC score. The value of the AUC score ranges from 0 to 1. The higher the AUC score, the better the model. This article discusses how to use the ROC curve in scikit learn.
ROC for Multi class Classification
Now, let us understand how to use ROC for multi class classifier. So, we will build a simple logistic regression model to predict the type of iris. We will be using the iris dataset provided by sklearn. The iris dataset has 4 features and 3 target classes (Setosa, Versicolour, and Virginica).