Repository navigation
Implement Analytical Derivatives on CompoundModel - #17034
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
CompoundModel
12b9ee7 to
33abdb9
Compare
|
Ok so just for the record as I am going to stop working on this for today: one of the remaining issues is related to |
8b1db7a to
9001005
Compare
|
The Polynomial2D thing was a red herring, fitters will just call |
9001005 to
ce0ff74
Compare
astrofrog
left a comment
There was a problem hiding this comment.
This looks good to me! Presumably @nden or @perrygreenfield should review too.
WilliamJamieson
left a comment
There was a problem hiding this comment.
These look good to me.
One comment, we should look into supporting the computation through function composition. This should be doable as that is just chain rule.
|
Yes I would like to add more operators to this but these are the most critical and I don't have time to get others in for feature freeze. |
|
Looks to me that this can now go in. I've opened #17250 as a reminder of @WilliamJamieson's suggestion to expand the scope later on. |
|
On one hand it is 'just' the chain rule but on the other hand I think it requires implementing derivatives with respect to x for all functions if I recall? (As current derivatives are relative to parameters). @Cadair and I did start looking into it but it seemed non trivial so decided to leave it for later. |
|
This PR caused a regression in 7.0.0: #17509
|
Better than hours afterwards ;) |

Description
This pull request adds support for computing analytical derivatives on
CompoundModelfor the +, -, * and / operators.Others are possible, but haven't been attempted yet.
The main motivation for this PR is to substantially improve the performance of fitting these models. The profiling script we are using which fits a
Const + Gaussian1Dmodel in parallel went from 28.1s to 19.8s so a 1.4x speedup.Probably Fixes #3783, but that might have a slightly larger scope