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

Why metrics : tpr != recall #155

Open
cosetteke opened this issue Sep 5, 2024 · 3 comments
Open

Why metrics : tpr != recall #155

cosetteke opened this issue Sep 5, 2024 · 3 comments

Comments

@cosetteke
Copy link

cosetteke commented Sep 5, 2024

i am using this package mt = MetricsDAG(est_causal_matrix, true_causal_matrix)

the source codedef _count_accuracy(B_est, B_true, decimal_num=4)
shows tpr: TP/(TP + FN)
recall: TP/(TP + FN)

why the result is different?

@cosetteke
Copy link
Author

B_est
[[0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0]
[0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0]
[0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0]
[0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0]
[0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0]
[0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0]
[0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0]
[0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1]
[0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0]]
B_true
[[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0]
[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1]]

@cosetteke
Copy link
Author

{'fdr': 0.2703, 'tpr': 0.9739, 'fpr': 10.0, 'shd': 126, 'nnz': 37, 'precision': 0.7368, 'recall': 0.1045, 'F1': 0.183, 'gscore': 0.0672}

@shaido987
Copy link
Collaborator

Hello, thanks for your bug report. I believe I have identified the issue, you can see the related PR. In summary, the recall value should be correct while the tpr currently is incorrect due to how it is computed. So you can simply use the recall value for now or apply the patch locally first (it only requires changing two lines in the source code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants