pyPESTO icon indicating copy to clipboard operation
pyPESTO copied to clipboard

What should a empty prior return?

Open elbaraim opened this issue 5 years ago • 5 comments

In the case where parameter priors are not defined in a optimization problem currently problem.x_priors returns None. To keep things simple (and integrate in the MCMC sampling workflow), I think it would be better to return zero in the case of "missing" priors and always work with the log prior object then. To sum up, in case of no priors defined, create a "dummy" prior that returns zero as log prior value, gradient and hessian.

  • Any thoughts on this?

elbaraim avatar Jun 09 '20 14:06 elbaraim

I think returning None is what I would expect. What about creating a copy of the objective and adding a zero-returning prior within the MCMC routines that need a prior?

FFroehlich avatar Jun 09 '20 14:06 FFroehlich

Why copy of the objective?

yannikschaelte avatar Jun 09 '20 15:06 yannikschaelte

It may be better to instead of a "zero" prior raise a warning and define a uniform prior based on the parameter bounds.

yannikschaelte avatar Jun 09 '20 15:06 yannikschaelte

Why copy of the objective?

To ensure we don't accidentally modify the original objective? Could also transiently add it and ensure its removed upon exit of the sampling routine.

FFroehlich avatar Jun 12 '20 16:06 FFroehlich

Agreed. So I would say create a copy of the objective, and make the posterior an aggregated objective of the objective and a uniform prior based on the lb,ub bounds.

yannikschaelte avatar Jun 12 '20 17:06 yannikschaelte