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

compute.compute_ap_contiguos returns NaNs silently #45

Open
afermg opened this issue Nov 8, 2023 · 0 comments
Open

compute.compute_ap_contiguos returns NaNs silently #45

afermg opened this issue Nov 8, 2023 · 0 comments

Comments

@afermg
Copy link
Contributor

afermg commented Nov 8, 2023

When using map.run_pipeline(), if some samples are only present once in the dataset compute.ap_contiguos returns zeros. This is due to compute.to_cutoffs being applied to an array of length 1, so the line in

cutoffs[0], cutoffs[1:] = 0, counts.cumsum()[:-1]
always returns [0].

These 0s are propagated to num_pos

num_pos = np.add.reduceat(rel_k_list, cutoffs)
and thus things are divided by zero, as this vector is used as a divisor
ap_scores = np.add.reduceat(pr_k * rel_k_list, cutoffs) / num_pos
.

It was a bit puzzling to figure out why my test with a small number of plates was plagued with nans, so it is probably worth adding a warning when 1 (or maybe a fraction, i.e., 1/4) of all elements appear only once.

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

1 participant