@@ -1808,9 +1808,44 @@ def x_fixed_indices(self) -> list[int]:
18081808 """Parameter table non-estimated parameter indices."""
18091809 return [i for i , p in enumerate (self .parameters ) if not p .estimate ]
18101810
1811+ @property
1812+ def has_map_objective (self ) -> bool :
1813+ """Whether this problem encodes a maximum a posteriori (MAP) objective.
1814+
1815+ A PEtab problem is considered to have a MAP objective if there is a
1816+ prior distribution specified for at least one estimated parameter.
1817+
1818+ :returns: ``True`` if MAP objective, ``False`` otherwise.
1819+ """
1820+ return any (
1821+ p .prior_distribution is not None
1822+ for p in self .parameters
1823+ if p .estimate
1824+ )
1825+
1826+ @property
1827+ def has_ml_objective (self ) -> bool :
1828+ """Whether this problem encodes a maximum likelihood (ML) objective.
1829+
1830+ A PEtab problem is considered to have an ML objective if there are no
1831+ prior distributions specified for any estimated parameters.
1832+
1833+ :returns: ``True`` if ML objective, ``False`` otherwise.
1834+ """
1835+ return all (
1836+ p .prior_distribution is None for p in self .parameters if p .estimate
1837+ )
1838+
18111839 def get_priors (self ) -> dict [str , Distribution ]:
18121840 """Get prior distributions.
18131841
1842+ Note that this will default to uniform distributions over the
1843+ parameter bounds for parameters without an explicit prior.
1844+
1845+ For checking whether this :class:`Problem` encodes a MAP or ML
1846+ objective, use :attr:`Problem.has_map_objective` or
1847+ :attr:`Problem.has_ml_objective`.
1848+
18141849 :returns: The prior distributions for the estimated parameters.
18151850 """
18161851 return {p .id : p .prior_dist for p in self .parameters if p .estimate }
0 commit comments