@@ -1815,9 +1815,44 @@ def x_fixed_indices(self) -> list[int]:
18151815 """Parameter table non-estimated parameter indices."""
18161816 return [i for i , p in enumerate (self .parameters ) if not p .estimate ]
18171817
1818+ @property
1819+ def has_map_objective (self ) -> bool :
1820+ """Whether this problem encodes a maximum a posteriori (MAP) objective.
1821+
1822+ A PEtab problem is considered to have a MAP objective if there is a
1823+ prior distribution specified for at least one estimated parameter.
1824+
1825+ :returns: ``True`` if MAP objective, ``False`` otherwise.
1826+ """
1827+ return any (
1828+ p .prior_distribution is not None
1829+ for p in self .parameters
1830+ if p .estimate
1831+ )
1832+
1833+ @property
1834+ def has_ml_objective (self ) -> bool :
1835+ """Whether this problem encodes a maximum likelihood (ML) objective.
1836+
1837+ A PEtab problem is considered to have an ML objective if there are no
1838+ prior distributions specified for any estimated parameters.
1839+
1840+ :returns: ``True`` if ML objective, ``False`` otherwise.
1841+ """
1842+ return all (
1843+ p .prior_distribution is None for p in self .parameters if p .estimate
1844+ )
1845+
18181846 def get_priors (self ) -> dict [str , Distribution ]:
18191847 """Get prior distributions.
18201848
1849+ Note that this will default to uniform distributions over the
1850+ parameter bounds for parameters without an explicit prior.
1851+
1852+ For checking whether this :class:`Problem` encodes a MAP or ML
1853+ objective, use :attr:`Problem.has_map_objective` or
1854+ :attr:`Problem.has_ml_objective`.
1855+
18211856 :returns: The prior distributions for the estimated parameters.
18221857 """
18231858 return {p .id : p .prior_dist for p in self .parameters if p .estimate }
0 commit comments