1

The output of my multi-class classifier looks like this as shown below for which i need to plot ROC curve and get auc

Utterence   Actual   Predicted   Conf_intent1 Conf_Intent2 Conf_Intent3  

Uttr 1      Intent1  Intent1      0.86           0.45         0.24
Uttr2       Intent3  Intent2      0.47           0.76         0.55
Uttr3       Intent1  Intent1      0.70           0.20         0.44
Uttr4       Intent3  Intent2      0.42           0.67         0.56
Uttr5       Intent1  Intent1      0.70           0.55         0.36
Note: Probability is done on absolute scoring so will not add to 1 for particular utterence the highest probability will be predicted

From my code I have made the confusion matrix like this:

import pandas as pd 
import numpy as np 
from sklearn.metrics import multilabel_confusion_matrix
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report

#reading the input file
df = pd.read_excel('C:\\testsamples.xlsx')

#Converting the columns to array
actual = df['Actual'].to_numpy()
predicted = df['Predicted'].to_numpy()


mcm = multilabel_confusion_matrix(actual, predicted)

How can I plot ROC curve from this for each Intent1,2 and 3 and take out relevant information such as auc?

think-maths
  • 917
  • 2
  • 10
  • 28
  • Confusion matrix, you have is for certain threshold of classification. To create ROC curve, you need multiple confusion matrix for all multiple thresholds. Refer: https://stackoverflow.com/questions/43201576/how-to-draw-roc-curve-using-value-of-confusion-matrix – Parth Sep 19 '19 at 08:43
  • @Parth I was unclear from question earlier I have updated my question and have shown how my classifier looks and how I am have derived the confusion matrix....so from here I need help to create ROC curve – think-maths Sep 19 '19 at 09:29
  • This might help: https://stackoverflow.com/questions/45332410/sklearn-roc-for-multiclass-classification – IWHKYB Sep 19 '19 at 09:31

0 Answers0