lmfit-py
lmfit-py copied to clipboard
[ENH] Confidence Interval improvements
The CI calculation now uses the root_scalar interface for root finding and changes the default method to toms748. Additonally, caching of probabilties is now used to speed up the calculation.
Description
Improves the CI calculation by using some caching and using another root finding method.
Type of Changes
- [ ] Bug fix
- [ ] New feature
- [x] Refactoring / maintenance
- [ ] Documentation / examples
Tested on
Python: 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)]
lmfit: latest master, scipy: 1.7.1, numpy: 1.20.3, asteval: 0.9.23, uncertainties: 3.1.6
Verification
Have you
- [ ] included docstrings that follow PEP 257?
- [ ] referenced existing Issue and/or provided relevant link to mailing list?
- [x] verified that existing tests pass locally?
- [x] verified that the documentation builds locally?
- [x] squashed/minimized your commits and written descriptive commit messages?
- [x] added or updated existing tests to cover the changes?
- [ ] updated the documentation and/or added an entry to the release notes (doc/whatsnew.rst)?
- [ ] added an example?
@Tillsten Thanks very much for this -- I think it looks good. If @reneeotten has no objection, I propose that we merge this.
Sorry, busy days... I'll take a look tonight!
@reneeotten Thanks! And yes, I believe the idea that root_scaler
is both the "more recent, supported" root-finding method, and that toms748
is almost always faster (# of function calls) than the brent
method.
And I think that break
at the test for "has solution converged" is within a for loop, expressing "if a solution is not converged don't bother trying to bracket the uncertainties for the other probabilities".
@reneeotten any objections to merging this?
@Tillsten OK, merging this, thanks!
@reneeotten any objections to merging this?
not really, other than the comments that I left earlier: to squash the commits to remove the flurry of commits including a "merge-commit" and adding an entry to whatsnew.rst
indicating this change.