Monday, 14 March 2022

how do I calculate TAR (%) @ FAR = 0.1% in Python?

I was reading a paper and the results in the paper are presented in the following way:

enter image description here

I want to have a similar table for my model. Using the below code I got FAR and TAR values.

from sklearn import metrics
far, tar, thresholds = metrics.roc_curve(Y_test,p)

**Edited

test = [0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,1 ,0 ,0 ,0 ,1, 0]        
pred = [0.04172871, 0.01611879, 0.01073375, 0.03344169 ,0.04172871, 0.04172871, 0.00430162 ,0.04172871 ,0.04172871 ,0.04172871 ,0.07977659, 0.905772,0.9396076,  0.03344169, 0.04172871, 0.09125287, 0.02964183, 0.0641269,0.04172871 ,0.04172871, 0.04172871, 0.0641269 , 0.04172871, 0.04172871,0.9919831 , 0.04172871, 0.01611879 ,0.04172871, 0.37865442 ,0.00240888]
far, tar, thresholds = metrics.roc_curve(Y_test,p)

How should I fix FAR = 0.1% and How do I calculate TAR% @FAR = 0.1% using Python?



from how do I calculate TAR (%) @ FAR = 0.1% in Python?

No comments:

Post a Comment