Print ROC AUC Receiver Operating Characteristic Area Under Curve

The receiver operating characteristic area under curve is a way to measure the performance of a classification model, may be created using algorithms like Logistic Regression.

ROC-AUC is basically a graph where we plot true positive rate on y-axis and false positive rate on x-axis.

If a model is good the AUC will be close to 1.

Area Under Curve measures the performance of model better than accuracy because ROC-AUC does not depend on size of test data.

Note that TPR and FPR are defined as below in the context of getting Confusion Matrix plotted.

True Positive Rate or TPR = It is number of correct positive predictions divided by the total number of positives = TP/(TP+FN)

False Positive Rate or FPR = It is number of incorrect positive predictions divided by total number of negatives = FP/(TN+FP)

The ROC-AUC plot is used to visualize and represent the performance of the classifier model.

We can print the receiver operating characteristic area under curve using scikit-learn by first importing below libraries.

import matplotlib.pyplot as pyplt
from sklearn.metrics import roc_auc_score
from sklearn.metrics import roc_curve
from sklearn.metrics import auc