How to calculate auc or roc or auc-roc score from y_true
and y_pred
values for SINGLE CLASS in y_true
using python code.
I have checked various similar questions on stackoverflow and internet but the task is not solved or the output is not that is expected.
Here is example of y_true
and y_pred
values.
y_true = numpy.array([1,1,1])
y_pred = numpy.array([0.36,0.82,0.46])
Or,
y_true = [1,1,1]
y_pred = [0.36,0.82,0.46]
As a mention, I have checked with various built-in functions of python libraries and found that although the true-positive-rate can be found but the false-positive-rate is shown as nan or not a number.
tensorflow and/or theano and/or pytorch and/or caffe and/or sklearn and/or other python libraries or modified function of python can be used to find AUC or ROC or AUC-ROC score value from y_true of single class value 1's and y_pred predicted scores.
Please comment if you need more details.
If you will read about how roc auc works (https://medium.com/@penggongting/understanding-roc-auc-pros-and-cons-why-is-bier-score-a-great-supplement-c7a0c976b679 or https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc) you will understand, that roc auc it's not about scoring, it's about sorting. And there is answer on your question: if you try to calculate a class with one value, how can you sort it? - nohow, you can't sort it. That's why you can't calculate it.