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

Prediction results envelop computation fails when there's only NaN #17

Closed
IvanHeriver opened this issue Oct 15, 2024 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@IvanHeriver
Copy link
Collaborator

Description

When the prediction spagetti file contains only NaN in a particular row, BaM will fail in the envelop computation and crash with the error At line 89 of file quicksort_X_INC.f90 (it is actually in the miniDMSL lib that the crash occurs). Sorting only NaN is indeed not possible in this case, that is why BaM crashes... However, it would be usefull to simply return NaN for any quantile (or other statistics) computed this way instead of crashing. A simple check before computing any stats could be done so any statistics computation is bypassed in this particular case.

This is an annoying bug for me. It is currently blocking me In my development of BaRatinAGE although I can imagine some workaround on my end.

Reproduction of the bug

You can run the following example to reproduce the error. From within the config files directory, run /path/to/BaM -cf "./Config_BaM.txt.

ISSUE_ENV_STAT_COMPUTATION_FAILS.zip

If you want to prevent failure, simply remove the first 50 values from input_prediction_data.txt and edit the file Config_Pred_u.txt file to indicate that there are 50 observations instead of 100 in the second row.

@IvanHeriver IvanHeriver added the bug Something isn't working label Oct 15, 2024
benRenard added a commit that referenced this issue Jan 24, 2025
…ed when computing spaghettis (e.g. when predicting h^theta with h<0). This causes a crash when computing envelops because sorting NAs is impossible.

This fixes issue #17.
@benRenard
Copy link
Member

fixed in commit 5c7720f.

This is a bit tricky because I'm not fully familiar with the handling of NAs in Fortran, as it depends on compiler settings. What I did is implementing a NA check by testing (value/=value) (which is true if value is NA), and returning the unfeasible flag in envelops when computation becomes impossible (I used an unfeasible flag rather than NAs because I don't want to manipulate them explicitly in the code).

That being said, I think the best practice is to try catching the problem before it occurs. In the formula you used for instance, this means replacing h^c by e.g. -9999.99*issneg(h) + (ispos(h)*h)^c (returns -9999.99 if h<0, h^c otherwise)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants