I'm new to SciKit and Python.
Currently I am trying to generate a multiclass (3 classes) ROC curve from csv file that looks like this:
probability,predclass,dist0,dist1,dist2,actualclass
99.94571208953857,1,0.00022618949060415616,99.94571208953857,0.054055178770795465,1
99.99398589134216,0,99.99398589134216,0.001082851395040052,0.004925658140564337,0
99.97997879981995,1,0.015142260235734284,99.97997879981995,0.004879535117652267,1
93.58544945716858,2,5.507804825901985,0.9067309089004993,93.58544945716858,2
92.31788516044617,1,7.572370767593384,92.31788516044617,0.10974484030157328,1
62.839555740356445,1,2.3740695789456367,62.839555740356445,34.786370396614075,2
...
and my current code is:
df = pd.read_csv('mydata.csv')
pred = ( df.loc[:,['dist0','dist1','dist2']])/100
actual = df['actualclass']
fpr, tpr, _ = roc_curve(actual, pred)
I have tried solution from this question: https://stackoverflow.com/a/45335434/14482749
by doing:
for i in range(n_classes):
fpr[i], tpr[i], _ = roc_curve(actual, pred[:, i])
roc_auc[i] = auc(fpr[i], tpr[i])
but received an error : TypeError: '(slice(None, None, None), 0)' is an invalid key at line 2 above.
I believe the problem is my var 'actual' but I am not sure what is it