@@ -1820,9 +1820,44 @@ def x_fixed_indices(self) -> list[int]:
18201820 """Parameter table non-estimated parameter indices."""
18211821 return [i for i , p in enumerate (self .parameters ) if not p .estimate ]
18221822
1823+ @property
1824+ def has_map_objective (self ) -> bool :
1825+ """Whether this problem encodes a maximum a posteriori (MAP) objective.
1826+
1827+ A PEtab problem is considered to have a MAP objective if there is a
1828+ prior distribution specified for at least one estimated parameter.
1829+
1830+ :returns: ``True`` if MAP objective, ``False`` otherwise.
1831+ """
1832+ return any (
1833+ p .prior_distribution is not None
1834+ for p in self .parameters
1835+ if p .estimate
1836+ )
1837+
1838+ @property
1839+ def has_ml_objective (self ) -> bool :
1840+ """Whether this problem encodes a maximum likelihood (ML) objective.
1841+
1842+ A PEtab problem is considered to have an ML objective if there are no
1843+ prior distributions specified for any estimated parameters.
1844+
1845+ :returns: ``True`` if ML objective, ``False`` otherwise.
1846+ """
1847+ return all (
1848+ p .prior_distribution is None for p in self .parameters if p .estimate
1849+ )
1850+
18231851 def get_priors (self ) -> dict [str , Distribution ]:
18241852 """Get prior distributions.
18251853
1854+ Note that this will default to uniform distributions over the
1855+ parameter bounds for parameters without an explicit prior.
1856+
1857+ For checking whether this :class:`Problem` encodes a MAP or ML
1858+ objective, use :attr:`Problem.has_map_objective` or
1859+ :attr:`Problem.has_ml_objective`.
1860+
18261861 :returns: The prior distributions for the estimated parameters.
18271862 """
18281863 return {p .id : p .prior_dist for p in self .parameters if p .estimate }
0 commit comments