How calculate a true negatives in my case (to make a ROC analisys)?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
KALYAN ACHARJYA
el 21 de Jun. de 2020
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.
Respuestas (0)
Ver también
Categorías
Más información sobre Detection en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!