How calculate a true negatives in my case (to make a ROC analisys)?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello together,
I have a motor that rotating in a light gate and producing a ground truth "G"
A microphone that take an audio capture of this motor.
An algorithm, analyze this audio capture and detect a ground truth (F0/F1) in spectrum "R"
I calculate a TP/FN/FP with (pseudo code):
if R is element from G-array % right motorspeed detected
than TP = TP + 1;
if R is not element from G-array % wrong motorspeed detected
than FP = FP + 1;
if G not element from R-array %motorspeed is not detected
than FN = FN + 1;
end
with a code (in a loop):
motor_actual = nonzeros(unique(motor_actual)); %No zeros no repeats
motorspeed_detected = nonzeros(unique(motorspeed_detected)); %No zeros no repeats
Analyse1 = ismembertol(motorspeed_detected, motor_actual*harm, tube_cnt, 'DataScale' , 1); %Elements of R in G +-tolerance
Analyse2 = ismembertol(motor_actual*harm, motorspeed_detected, tube_cnt, 'DataScale' , 1); %Elements of G in R +-tolerance
TP_help = nnz(Analyse1); %right frequency detected
FP_help = nnz(~Analyse1); %wrong frequency detected
FN_help = nnz(~Analyse2); %no frequency detected
TP = TP + TP_help;
FP = FP + FP_help;
FN = FN + FN_help;
Now, I have to create a receiver operating characteristic curve (ROC curve).
To do this I need a true positive rate: TP_rate = TP/(TP+FN) and false positive rate: FP_rate = FP/(FP+TN)
So, I need also to calculate TN!
The condition for TM is:
if R is element from G-array == 0 %right motor stop detecting
TN = TN + 1;
end
But how is this possible, when:
1. my motor is always on, so ground truth G is > 0
2. algorithm can detect just positive values R > 0
So, TN = 0?
So I have always FP_rate = FP/(FP+0) = 1?
Or I can use another method to find a FP_Rate?
Thank you in advice!
4 件のコメント
KALYAN ACHARJYA
2020 年 6 月 21 日
Sorry not getting the exact logic. Is this "producing a ground truth "G"? Ground truth for the comparison, whether the code classify the right or wrong.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Detection についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!