File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -1856,11 +1856,28 @@ def get_priors(self) -> dict[str, Distribution]:
18561856 Note that this will default to uniform distributions over the
18571857 parameter bounds for parameters without an explicit prior.
18581858
1859- For checking whether this :class:`Problem` encodes a MAP or ML
1860- objective, use :attr:`Problem.has_map_objective` or
1861- :attr:`Problem.has_ml_objective`.
1859+ :returns: The prior distributions for the estimated parameters in case
1860+ the problem has a MAP objective, an empty dictionary otherwise.
1861+ """
1862+ if not self .has_map_objective :
1863+ return {}
1864+
1865+ return {
1866+ p .id : p .prior_dist if p .prior_distribution else Uniform (p .lb , p .ub )
1867+ for p in self .parameters
1868+ if p .estimate
1869+ }
1870+
1871+ def get_startpoint_distributions (self ) -> dict [str , Distribution ]:
1872+ """Get distributions for sampling startpoints.
1873+
1874+ The distributions are the prior distributions for estimated parameters
1875+ that have a prior distribution defined, and uniform distributions
1876+ over the parameter bounds for estimated parameters without an explicit
1877+ prior.
18621878
1863- :returns: The prior distributions for the estimated parameters.
1879+ :returns: Mapping of parameter IDs to distributions for sampling
1880+ startpoints.
18641881 """
18651882 return {
18661883 p .id : p .prior_dist if p .prior_distribution else Uniform (p .lb , p .ub )
You can’t perform that action at this time.
0 commit comments