pints-team / pints

Probabilistic Inference on Noisy Time Series
http://pints.readthedocs.io
Other
226 stars 33 forks source link

implement gradients/sensitivities for toy problems #298

Closed martinjrobins closed 1 year ago

martinjrobins commented 6 years ago

Many other tickets refer to gradient based methods (#22 #283 #293 #104). First step is to implement gradients for the toy problems

Not doing:

MichaelClerx commented 6 years ago

I don't think we need it for all problems, do we? I don't want us to get carried away doing lots of nice gradient-based stuff when in real life we hardly ever have them.

(I know there's ways to get them, but they've been around for decades and still don't see much use, that worries me!)

martinjrobins commented 6 years ago

probably start by doing for one easy problem and one hard one to get an idea of how the gradient-based stuff works (presumably after that we can just say "nope, doesn't work").

MichaelClerx commented 6 years ago

See also #43 #118

martinjrobins commented 6 years ago

I'll wait until @sanmitraghosh verifies the correctness of the fitzhugh nagumo sensitivities before I merge it in...

ben18785 commented 6 years ago

Good stuff @martinjrobins - thanks for doing this.

sanmitraghosh commented 6 years ago

@martinjrobins corrected the FN model in your branch. Have a look.

sanmitraghosh commented 6 years ago

I think its pretty easy to test if the sensitivities are correct by using theano gradient test. I am attaching here a theano test file I have written for the FN model. theano_tensorflow_sensitivitytests.zip @martinjrobins @MichaelClerx Assuming theano is installed, extract the file and run theano-nose test_pintsModelSens.py

To do the same with tensorflow run the attached jupyter notebook.

martinjrobins commented 6 years ago

Thanks @sanmitraghosh for testing the gradient

sanmitraghosh commented 6 years ago

@martinjrobins I have uploaded these files now in master branch studies folder. commit issue-298-sensitivities

MichaelClerx commented 6 years ago

Now that we have an easy one and a hard one, shall we close this ticket?

MichaelClerx commented 6 years ago

@martinjrobins says yes

ben18785 commented 5 years ago

@martinjrobins @MichaelClerx Think we do need this for the toy pdfs (and they're easy to do) so am reopening.

MichaelClerx commented 5 years ago

@ben18785 which ones specifically? Can you update the list at the top?

ben18785 commented 5 years ago

@MichaelClerx Have done so. I am happy to add these to be honest -- shouldn't take too long for the toy pdfs.

MichaelClerx commented 5 years ago

I think we've got plenty now that have sensitivities, so closing this!

ben18785 commented 5 years ago

Not sure we have many toy models (not toy distributions). Can we keep this open please?

On Mon, Aug 19, 2019 at 10:59 AM Michael Clerx notifications@github.com wrote:

Closed #298 https://github.com/pints-team/pints/issues/298.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/pints-team/pints/issues/298?email_source=notifications&email_token=ABCILKB3HE6UDXDJTAX6IA3QFJVGNA5CNFSM4EXY7W52YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOTDXA2FA#event-2565737748, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCILKE6BC2V44OZGBVNQHTQFJVGNANCNFSM4EXY7W5Q .

MichaelClerx commented 5 years ago

If you have some idea for how to implement it, then yes. The ones I've looked at (SIR, hes1, Lotka-Volterra, Repressilator) all use scipy to integrate an ODE, so don't offer an easy way to obtain the sensitivities. This is fine by me, as it reflects the real-world situation

ben18785 commented 5 years ago

Yep, I think either getting sensitivities via the Jacobian method or (better) using adjoints is fine. I'd also be happy if this were implemented in a notebook to show others how to do it...

On Mon, Aug 19, 2019 at 11:07 AM Michael Clerx notifications@github.com wrote:

If you have some idea for how to implement it, then yes. The ones I've looked at (SIR, hes1, Lotka-Volterra, Repressilator) all use scipy to integrate an ODE, so don't offer an easy way to obtain the sensitivities. This is fine by me, as it reflects the real-world situation

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/pints-team/pints/issues/298?email_source=notifications&email_token=ABCILKAGZUT6R7R66VFHPPLQFJWGBA5CNFSM4EXY7W52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4SMGOY#issuecomment-522502971, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCILKAWCM73EBFUOFVV5C3QFJWGBANCNFSM4EXY7W5Q .

MichaelClerx commented 5 years ago

Well, feel free! But maybe we should pick a specific model and create an issue for that? I don't want to give the impression that it's a requirement for all toy models/problems to have sensitivities implemented

martinjrobins commented 5 years ago

pretty sure the fitzhugh nagumo model uses the Jacobian method to get the sensitivities

MichaelClerx commented 5 years ago

Perhaps see https://github.com/pints-team/pints/issues/501

MichaelClerx commented 5 years ago

https://github.com/pints-team/pints/issues/650

MichaelClerx commented 4 years ago

Is that enough to play with @ben18785 ? Can we shut this issue now?

MichaelClerx commented 4 years ago

Many addressed in #1038 now. I'd be happy to shut this issue

ben18785 commented 4 years ago

Let's keep it open as have a few ones here I still want to implement

On Tue, Mar 31, 2020 at 5:38 PM Michael Clerx notifications@github.com wrote:

Many addressed in #1038 https://github.com/pints-team/pints/pull/1038 now. I'd be happy to shut this issue

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pints-team/pints/issues/298#issuecomment-606740090, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCILKCCNSEMNOL73SEWL33RKIMATANCNFSM4EXY7W5Q .

MichaelClerx commented 1 year ago

Some more weren't ticked off. Remaining ones are all tricky. Closing this as initial issue (need for some gradients to test gradient-based samplers) has been more than met.