cytomining / cytomining/copairs
compute.compute_ap_contiguos returns NaNs silently
- Dominant language
- Python
- Stars
- 24
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
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 https://github.com/cytomining/copairs/blob/491ebafbd8bb09088b9fdfd261b5f2b2157f0d93/src/copairs/compute.py#L171 always returns [0].
These 0s are propagated to num_pos https://github.com/cytomining/copairs/blob/491ebafbd8bb09088b9fdfd261b5f2b2157f0d93/src/copairs/compute.py#L97 and thus things are divided by zero, as this vector is used as a divisor https://github.com/cytomining/copairs/blob/491ebafbd8bb09088b9fdfd261b5f2b2157f0d93/src/copairs/compute.py#L105.
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.
Contributor guide
Assessment
This issue has not been assessed yet.