Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert accuracy metrics to float #1893

Merged
merged 4 commits into from
Feb 5, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions splink/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ def truth_space_table_from_labels_with_predictions_sqls(
cast(TN as float)/N as specificity,
case when TN+FN=0 then 1 else cast(TN as float)/(TN+FN) end as npv,
cast(TP+TN as float)/(P+N) as accuracy,
2.0*TP/(2*TP + FN + FP) as f1,
5.0*TP/(5*TP + 4*FN + FP) as f2,
1.25*TP/(1.25*TP + 0.25*FN + FP) as f0_5,
4.0*TP*TN/((4.0*TP*TN) + ((TP + TN)*(FP + FN))) as p4,
cast(2.0*TP/(2*TP + FN + FP) as float) as f1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all of these should be float8 for consistency (see comments on PR)

cast(5.0*TP/(5*TP + 4*FN + FP) as float) as f2,
cast(1.25*TP/(1.25*TP + 0.25*FN + FP) as float) as f0_5,
cast(4.0*TP*TN/((4.0*TP*TN) + ((TP + TN)*(FP + FN))) as float) as p4,
case when TN+FN=0 or TP+FP=0 or P=0 or N=0 then 0
else cast((TP*TN)-(FP*FN) as float)/sqrt((TP+FP)*P*N*(TN+FN)) end as phi

Expand Down
Loading