ICB-DCM / pyPESTO

python Parameter EStimation TOolbox
https://pypesto.readthedocs.io
BSD 3-Clause "New" or "Revised" License
216 stars 47 forks source link

Easy switching between likelihood and posterior #1325

Open arrjon opened 5 months ago

arrjon commented 5 months ago

Feature description Depending on the context, the pypesto objective can be a likelihood or a posterior. It would be nice to have easy acess to both, e.g. if I have defined the objective as the posterior and added x_priors to get the likelihood by something like self.problem.objective(x, priors=False).

Motivation/Application Depending on whether one is using optimisation or sampling, either the likelihood, the posterior or both might be requiered. Beeing able to quickly switch between them would make code more readable, see for instance #1324.

The old issue #414 might be related to this.

vwiela commented 5 months ago

Agreed, one could maybe add a flag or method to the objective, to distinguish different kind of objectives.

Additionally, it seems like that naming and comments in some example notebooks needs some revision then as well.

dweindl commented 5 months ago

Independent of switching between types, it would be great to know what type of objective one is dealing with. Then things like profile likelihoods should refuse to work with random objective functions.

Agreed, one could maybe add a flag or method to the objective, to distinguish different kind of objectives.

:+1:

Either some flag, or something like PosteriorObjective(ObjectiveBase) that has a .getNegLogLikelihood[Objective]().