0

how do I calculate TDR (%) @ FDR = 0.02% in Python?

I have found the ROC curve and stored the fprs, tprs , threshold and interpret the value of tpr at different fpr values but the problem is there a difference between TDR @ %FDR and TPR @ % FPR and if there is a difference how can i get the array of TDR's and FDR's

1 Answer 1

0

To calculate TDR at FDR of 0.02%, you'd typically need a dataset or results from a model. Assuming you have the number of true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN), you can calculate TDR and FDR as follows:

TDR = TP ÷ (TP + FN)

FDR = FP ÷ (FP + TP)

def calculate_tdr(tp, fn):
    return tp / (tp + fn)

def calculate_fdr(fp, tp):
    return fp / (tp + fp)

# Example values
tp = 90
fn = 10
fp = 2

tdr = calculate_tdr(tp, fn)
fdr = calculate_fdr(fp, tp)

print(f"TDR: {tdr*100:.2f}%")
print(f"FDR: {fdr*100:.2f}%")
1
  • Thanks Jamie, but does the area under the curve make sense when i plot TDR vs FDR ? i don't know what TDR vs. FDR actually represent. and interestingly their sum is not equal to 1 , they are not complement of each other
    – Amal
    Commented Apr 24 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.