Skip to content
Snippets Groups Projects
Commit 3d3fa9b4 authored by Gordian Edenhofer's avatar Gordian Edenhofer
Browse files

likelihood: Add simple __str__ method

parent a58503b5
No related branches found
No related tags found
1 merge request!1007LikelihoodSum: Join/reduce summands in multi-likelihood sum
......@@ -392,6 +392,9 @@ class Likelihood(LazyModel):
lp = LikelihoodPartial(self, primals=primals, point_estimates=point_estimates)
return lp, lp.splitx(primals)[0]
def __str__(self):
return f"{self.__class__.__name__}()"
class LikelihoodPartial(Likelihood):
"""Likelihood with partially inserted `primals`."""
......@@ -491,6 +494,10 @@ class LikelihoodPartial(Likelihood):
"""
return _parse_point_estimates(self.point_estimates, primals)[1:]
def __str__(self):
args_str = f"{self.likelihood}, point_estimates={self.point_estimates}"
return f"{self.__class__.__name__}({args_str})"
class _ChainModel(LazyModel):
forward_left: Callable = field(metadata=dict(static=False))
......@@ -647,6 +654,9 @@ class LikelihoodWithModel(Likelihood):
likelihood_argnames=likelihood_argnames,
)
def __str__(self):
return f"{self.likelihood}.amend({self.forward})"
class LikelihoodSum(Likelihood):
likelihood_summands: Tuple[Likelihood] = field(metadata=dict(static=False))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment