pints icon indicating copy to clipboard operation
pints copied to clipboard

Updated first examples to show model-free case.

Open MichaelClerx opened this issue 1 year ago • 8 comments

After discussion today, seems like we should start the first examples by showing you need an error/logpdf, then move on to show how PINTS lets you define one for time series

MichaelClerx avatar Mar 19 '24 16:03 MichaelClerx

@ben18785 @chonlei @martinjrobins do you think this makes sense? It was a little unclear that you could use PINTS for any old function

MichaelClerx avatar Mar 19 '24 16:03 MichaelClerx

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (13b263a) to head (9ffbe94).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1520   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           97        97           
  Lines         9577      9577           
=========================================
  Hits          9577      9577           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 19 '24 16:03 codecov[bot]

(I did actually think you couldn't use PINTS for 1D optimisation though - I'm pretty sure I encountered an error when I tried to use it for a 1D problem a while ago, and I thought someone else had told me that they'd also experienced this.)

I'm guessing you did what I did initially, and used a scalar parameter instead of a length-1 vector?

MichaelClerx avatar Mar 22 '24 12:03 MichaelClerx

(I did actually think you couldn't use PINTS for 1D optimisation though - I'm pretty sure I encountered an error when I tried to use it for a 1D problem a while ago, and I thought someone else had told me that they'd also experienced this.)

I'm guessing you did what I did initially, and used a scalar parameter instead of a length-1 vector?

I can't fully remember, but from looking back at my code I think you're probably correct. I do remember seeing an error raised by PINTS which said that it didn't support the 1D case. I think maybe @I-Bouros experienced something similar.

k-shep avatar Mar 22 '24 14:03 k-shep

(I did actually think you couldn't use PINTS for 1D optimisation though - I'm pretty sure I encountered an error when I tried to use it for a 1D problem a while ago, and I thought someone else had told me that they'd also experienced this.)

I'm guessing you did what I did initially, and used a scalar parameter instead of a length-1 vector?

I can't fully remember, but from looking back at my code I think you're probably correct. I do remember seeing an error raised by PINTS which said that it didn't support the 1D case. I think maybe @I-Bouros experienced something similar.

That's true from my experience PINTS does not work with optimising or sampling single parameters.

I-Bouros avatar Mar 25 '24 08:03 I-Bouros

OK Can you dig out a specific example? The notebooks in this PR show both a 1d optimisation and a 1d sampling problem, so it's definitely not impossible in general :D

MichaelClerx avatar Mar 25 '24 11:03 MichaelClerx

OK Can you dig out a specific example? The notebooks in this PR show both a 1d optimisation and a 1d sampling problem, so it's definitely not impossible in general :D

I can describe the phenomenon, as it appears in my own work: I am working with an SEIR model for which I am trying to infer one parameter beta. I use my usual approach in which I write up a pints.LogPDF, pints.LogPrior and a pints.LogPosterior objects, and then when I try to run it (with 3 chains, so is not that issue), I get this error message:

Screenshot 2024-03-25 at 14 00 23

I-Bouros avatar Mar 25 '24 14:03 I-Bouros

Oh, that's interesting! Seems to be coming directly from CMA-ES. We should add a notice to the CMA-ES optimiser to say it doesn't support 1-d optimisations. Alternatively could try and catch this error and replace it with a more informative one

MichaelClerx avatar Mar 25 '24 14:03 MichaelClerx