Issue
I want to calculate AUROC using dataset with all instance zero. However, the following error occurred:
ValueError: Only one class present in y_true. ROC AUC score is not defined in that case
def computeAUROC (dataGT, dataPRED, classCount):
outAUROC = []
datanpGT = dataGT.cpu().numpy()
datanpPRED = dataPRED.cpu().numpy()
for i in range(classCount):
outAUROC.append(roc_auc_score(datanpGT[:, i], datanpPRED[:, i]))
return outAUROC
Solution
You cannot have an ROC curve without both positive and negative examples in your dataset. With only one class in the dataset, you cannot measure your false-positive rate, and therefore cannot plot an ROC curve. This is why you get this error message.
Answered By - Shai
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.