How to draw ROC curve for Equal Error Rate (FAR vs FRR)

10 Ansichten (letzte 30 Tage)
As 'perfcurve' function is used for drawing ROC curve for False Positive Rate vs True Positive Rate. Which function may be used for drawing ROC curve for Equal Error Rate (False Acceptance Rate vs False Rejection Rate)?

Akzeptierte Antwort

Namnendra
Namnendra am 21 Sep. 2024
Hi Syed,
In MATLAB, while the `perfcurve` function is primarily designed to plot the ROC curve in terms of False Positive Rate (FPR) versus True Positive Rate (TPR), you can still use it to derive the necessary metrics to plot False Acceptance Rate (FAR) versus False Rejection Rate (FRR). Here's how you can achieve that:
Steps to Plot FAR vs FRR in MATLAB:
1. Use `perfcurve` to get FPR and TPR.
2. Calculate FAR and FRR from FPR and TPR.
3. Plot FAR against FRR.
Here's a sample MATLAB code to illustrate this:
% Example data
labels = [0 0 1 1]; % True labels (0 for negative class, 1 for positive class)
scores = [0.1 0.4 0.35 0.8]; % Predicted scores
% Compute ROC curve using perfcurve
[X, Y, T, AUC] = perfcurve(labels, scores, 1);
% Calculate FAR and FRR
FAR = X; % False Acceptance Rate is equivalent to False Positive Rate
FRR = 1 - Y; % False Rejection Rate is 1 - True Positive Rate
% Plot FAR vs FRR
figure;
plot(FAR, FRR, '-b', 'LineWidth', 2);
hold on;
% Find the Equal Error Rate (EER) point
EER_index = find(abs(FAR - FRR) == min(abs(FAR - FRR)));
EER = FAR(EER_index);
% Plot EER point
plot(FAR(EER_index), FRR(EER_index), 'ro', 'MarkerSize', 10, 'MarkerFaceColor', 'r');
text(FAR(EER_index), FRR(EER_index), sprintf(' EER = %.2f', EER), 'VerticalAlignment', 'bottom');
xlabel('False Acceptance Rate (FAR)');
ylabel('False Rejection Rate (FRR)');
title('ROC Curve for Equal Error Rate (EER)');
grid on;
legend('ROC Curve', 'EER Point');
hold off;
Explanation:
- FAR (False Acceptance Rate): This is equivalent to the False Positive Rate (FPR).
- FRR (False Rejection Rate): This is calculated as (1 - TPR).
- EER (Equal Error Rate): The point where FAR equals FRR.
By plotting FAR against FRR, you can identify the EER by finding the point where the two rates are equal or closest. The code provided will mark this point on the graph.
Thank you.

Weitere Antworten (0)

Kategorien

Mehr zu ROC - AUC finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by