Open elbaraim opened 4 years ago
Hm... I would guess that enforcing bounds makes sense, otherwise we might end up with an improper density, which might prohibit convergence of the chain... Personally, I find this behavior reasonable. However, one might want to issue a warning... Or add an option, which asks whether bounds should be enforced or neglected...
strictly speaking, you can only sample when you have some prior (however, improper priors are occasionally used, e.g. for Elba's project). Not sure whether the default should be to implicitly use the parameter bounds as such, or to request the user to explicitly specify a prior (could be done automatically as a "non-informative prior" when using petab).
Would find the "non-informative prior" as default reasonable. One discuss about adding an option to not enforce parameter bounds, however...
An option to not enforce bounds I would include at least. E.g. sometimes one wants to sample from a distribution directly, and not need to define bounds). This could also be realized by default bounds [-inf, inf].
I would not change the bounds...
For my gut feeling, "default bounds" should be those which are specified in the pyPESTO problem... (which are the same as in optimization then).
If you want to make the default not to use optimization bounds, then I would rather add the option as enforce_parameter_bounds=False
.
However, if bounds are used, the user should not have to re-enter them somehow...
Totally agreed. I meant if one wants to use pypesto to just sample from a distribution, inf bounds do the job just fine in the current implementation. But a flag to turn them on or off will be a cleaner solution, I think.
The discussion somehow raises the question whether we should distinguish between lower and upper parameter bounds bounds, and the interval on which the uniform distribution is defined.
For all distribution but the uniform one, parameters are specified separately. Indeed, for the distribution from which starting points are samples this would be particular important as sometimes these bounds should be chosen tighter than the actual search region.
I think in general it should be possible to enforce bounds without specifying a prior.
As discussed in the group meeting: If no prior is specified for sampling, I would issue a warning and return the information which prior is used. This should be output on the screen but maybe also written in the results object. Do we have there a flag about success, warning, ...?
The discussion somehow raises the question whether we should distinguish between lower and upper parameter bounds bounds, and the interval on which the uniform distribution is defined.
Definitely. In PEtab terms, the lower/upper parameter bounds correspond to lowerBound and upperBounds columns, while when a prior is uniform, its parameters are given in the priorParameters column. So the parameter bounds should not be used as a prior ever, except when no prior is specified, in which case they may become a uniform one, but with a big warning.
For all distribution but the uniform one, parameters are specified separately. Indeed, for the distribution from which starting points are samples this would be particular important as sometimes these bounds should be chosen tighter than the actual search region.
I think in general it should be possible to enforce bounds without specifying a prior. I think the best solution for enforcing bounds in sampling will be via setting a flag, as discussed above.
As discussed in the group meeting: If no prior is specified for sampling, I would issue a warning and return the information which prior is used. This should be output on the screen but maybe also written in the results object. Do we have there a flag about success, warning, ...?
Currently, there is no return flag / message yet, but one should be implemented similar to for optimization.
In the following line of code, the sample is checked to be within the parameter bounds used for optimization https://github.com/ICB-DCM/pyPESTO/blob/master/pypesto/sampling/metropolis.py#L59 this is how it was implemented in the MATLAB code.
This is implicitly assuming a uniform prior even in the case where a prior is not defined (i.e. improper prior). I guess this has been done for some reason, but technically one cannot really sample without prior information here.
If bounds are required, these could instead be explicitly specified as a uniform prior.