필터 지우기
필터 지우기

ROC curve - how automatically find the most suitable threshold?

조회 수: 28 (최근 30일)
Karolina
Karolina 2015년 12월 19일
편집: Luke Hubbard 2021년 4월 27일
I have a ROC curve for my data. I would like to find the most suitable threshold for data classification. The threshold should be located in place where False Positive Rate and True Positive Rate are balanced each other. From the interpretation of the ROC curve I know that should choice some threshold which is close to the left upper corner. Is there a way to find this threshold automatically?

답변 (4개)

Luke Hubbard
Luke Hubbard 2021년 4월 27일
편집: Luke Hubbard 2021년 4월 27일
Follow the example for plotting the ROC curve.
[X,Y,T,AUC,OPTROCPT] = perfcurve(labels,scores,posclass);
ThresholdForOptROCpt = T((X==OPTROCPT(1))&(Y==OPTROCPT(2)))

the cyclist
the cyclist 2015년 12월 19일
To find the best threshold, you first need to define what you mean by "best". Specifically, you need a function that determines the cost of each type of error. In some applications, a false positive is much more costly than a false negative. In other applications, the opposite is true.
After you figure that "cost function" out, then you minimize the cost along your ROC curve.
  댓글 수: 1
Karolina
Karolina 2015년 12월 19일
In the word balanced I meant the place where true negative rate is crossing true positive rate. Like here link please see figure "Sensitivity and specificity versus criterion value"

댓글을 달려면 로그인하십시오.


the cyclist
the cyclist 2015년 12월 19일
When you say you have the curve, I assume you have the (X,Y) coordinates of the curve, for example as output by the perfcurve function.
X = false positive rate, and 1-Y = false negative rate.
So, you can do
[minErrDiff,minIdx] = min(X,1-Y)
to find which value is closest to being balanced.

Dario Walter
Dario Walter 2020년 6월 16일
There is an output available in the perfcurve functions that returns the value you are looking for:
[X,Y,T,~,OPTROCPT,suby,subnames] = perfcurve(...)
OPTROCPT provides the required value.

카테고리

Help CenterFile Exchange에서 ROC - AUC에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by