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

add nan safe log&divide #2611

Merged
merged 3 commits into from
Dec 2, 2024
Merged

add nan safe log&divide #2611

merged 3 commits into from
Dec 2, 2024

Conversation

FFroehlich
Copy link
Member

Add guards to log & divide functions to avoid nans during gradient computation

@FFroehlich FFroehlich requested a review from a team as a code owner November 30, 2024 22:28
Copy link

codecov bot commented Nov 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.80%. Comparing base (851d389) to head (0c226e0).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2611      +/-   ##
===========================================
+ Coverage    77.78%   77.80%   +0.01%     
===========================================
  Files          329      329              
  Lines        21724    21737      +13     
  Branches      1477     1477              
===========================================
+ Hits         16899    16912      +13     
  Misses        4814     4814              
  Partials        11       11              
Flag Coverage Δ
cpp 74.14% <100.00%> (+0.01%) ⬆️
cpp_python 34.15% <69.23%> (+0.02%) ⬆️
petab 36.99% <69.23%> (+0.02%) ⬆️
python 72.48% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
python/sdist/amici/jax/model.py 76.34% <100.00%> (+1.63%) ⬆️
python/sdist/amici/jaxcodeprinter.py 95.00% <100.00%> (+2.69%) ⬆️

Copy link
Member

@dweindl dweindl left a comment

Choose a reason for hiding this comment

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

Makes sense to have that, but I am slightly worried that this may cover up potential issues in the model.

Depending on how common these issues are, make it optional? Also fine as is for now.

@FFroehlich
Copy link
Member Author

Makes sense to have that, but I am slightly worried that this may cover up potential issues in the model.

Depending on how common these issues are, make it optional? Also fine as is for now.

Rather common, happens with Bachmann, Laske, Lucarelli and Weber.

For jax we (currently) have to evaluate all possible observables for all timepoints and all loss functions as well as avoid nan values from ever occurring. There might be a smarter way of going about this, this seems reasonable to me. You will still end up with pretty big values (rather than infs/nans) anyways.

Copy link

sonarqubecloud bot commented Dec 2, 2024

@FFroehlich FFroehlich merged commit f3a97c2 into develop Dec 2, 2024
30 of 32 checks passed
@FFroehlich FFroehlich deleted the jax_nan_objective branch December 2, 2024 15:37
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

Successfully merging this pull request may close these issues.

2 participants