-
Notifications
You must be signed in to change notification settings - Fork 277
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
Improve performance of emcee #781
Conversation
ed5fd42
to
76bfc36
Compare
@peendebak Thanks, but also, really? Does that actually give a performance improvement? Generally speaking, performance is not a primary concern for most of Also, just to be clear: |
@newville I fully agree with you can the value of emcee does not lie in fitting. We fit our data using one of the other methods in lmfit, and then use emcee for further analysis (so the term fitting in the original description was a bit unfortunate). When profiling emcee (and other lmfit methods) I noticed quite some time is spend in the framework itself, and not in the objective function that the user supplies. I understand that the focus for lmfit is on functionality (e.g. the high-level |
@peendebak this PR is a proposed change to the code with the explicit intent of improving performance. But you have not given any indication that performance is improved. Why not? Making any changes in the use of |
@peendebak @newville I agree with Matt that some benchmarking of how much faster this is would indeed be useful. I find it hard to see why changing the order of the Having said that, whenever someone submits a PR or question/issue regarding So how about instead of merging this PR we do actually that work now as we might have an interested party, @peendebak, in contributing to that goal? It would also allow us to change the api much more since we don't need to be backwards compatible (we could leave So if you guys agree I will convert #601 from an Issue to a Discussion and we can continue there to decide how to organize this change and once that is settled writing the actual code should probably not to be too hard. Thoughts? |
@reneeotten I agree with all of that, including a further discussion and trying to make a plan to move use of |
@newville @reneeotten I will close the PR, as there is no support for I would be happy to use or review |
Description
This PR improves the performance of emcee by improving the internal
_lnprob
method.bounds
argument is passed in transposed format. This aligns better (assuming standard numpy memory layout) with the operation in_lnprob
performed with thebounds
.c
out of thesum
All changes are internal, the public api is unchanged.
There are more options to improve performance, but these require more extensive changes or changes to the public api.
Type of Changes
Tested on
Python: 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)]
lmfit: 1.0.2+29.gcd28293.dirty, scipy: 1.7.0, numpy: 1.21.5, asteval: 0.9.25, uncertainties: 3.1.5
Verification
Have you