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 bounds argument and split log(a*exp(b)) #149

Merged
merged 4 commits into from
Oct 10, 2024

Conversation

epsig
Copy link
Contributor

@epsig epsig commented Oct 8, 2024

No description provided.

@epsig epsig requested a review from veenstrajelmer October 8, 2024 11:46
@epsig epsig linked an issue Oct 8, 2024 that may be closed by this pull request
Copy link

codecov bot commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.82%. Comparing base (676ec3f) to head (177a7bb).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #149      +/-   ##
==========================================
+ Coverage   89.79%   89.82%   +0.02%     
==========================================
  Files           9        9              
  Lines        1235     1238       +3     
==========================================
+ Hits         1109     1112       +3     
  Misses        126      126              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarqubecloud bot commented Oct 8, 2024

Copy link
Collaborator

@veenstrajelmer veenstrajelmer left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution. I have visually checked the behavior of calc_overschrijding() and this still works as expected, with the improvement that the warning is not given. So your fix works beautifully. I have therefore updated some expected values in the tests. I have also accidentally reformatted the code with black which messes up the PR a bit, sorry about that. There is one suggestion about None instead of math.inf included below, if you agree with this please commit it as a change and after that (or otherwise) please go ahead and merge the PR.

Normally I would update the changelog (docs/whats-new.md), but since this fix does not impact "the user" I think that can be skipped.

@@ -339,6 +341,7 @@ def cost_func(params, *args):
x0=initial_guess,
args=(p_val_gt_threshold, threshold, values[values > threshold]),
method="Nelder-Mead",
bounds = [[-math.inf, math.inf], [1e-10, math.inf]],
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think math.inf can be replaced with None which might be slightly neater since it reverts to the default bounds in that case (which are most probably +/- math.inf)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried a few thinks like you suggested, but ended up with errors as: 'NoneType' object is not iterable, so I keep it as it is.

Copy link
Collaborator

@veenstrajelmer veenstrajelmer Oct 10, 2024

Choose a reason for hiding this comment

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

Maybe I should have been more clear, my suggestion was to use bounds = [[None, None], [1e-10, None]],. I think I successfully ran the testbank with this, but you might have done another test? Either way, since the PR is already merged I thing it is fine to leave it as is for now. Thanks for fixing this issue!

@epsig epsig merged commit fcab9c0 into main Oct 10, 2024
6 checks passed
@epsig epsig deleted the feature/139_nans_overschrijding branch October 10, 2024 07:14
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.

avoid RuntimeError due to nans in overschrijding
2 participants