pyPESTO icon indicating copy to clipboard operation
pyPESTO copied to clipboard

Easy switching between likelihood and posterior

Open arrjon opened this issue 1 year ago • 2 comments

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.

arrjon avatar Mar 11 '24 20:03 arrjon

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.

vwiela avatar Mar 12 '24 09:03 vwiela

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]().

dweindl avatar Mar 12 '24 09:03 dweindl