Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/causalrl/identification/decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class DecisionCertificate(NamedTuple):
msm_certified: bool | None # MSM layer robust to gamma_max? None if the MSM layer did not run
summary: str

def __str__(self) -> str:
return self.summary


def certify_decision(
outcomes: Sequence[float],
Expand Down
4 changes: 3 additions & 1 deletion tests/test_certify_decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ def test_decision_string_follows_sign(self):

def test_summary_is_human_readable(self):
y, f, z = _confounded_rows(8000, 0.0, seed=8)
summary = certify_decision(y, f, confounder_bins=z).summary
cert = certify_decision(y, f, confounder_bins=z)
summary = cert.summary
assert isinstance(summary, str) and summary
assert "prefer treated" in summary
assert str(cert) == summary

def test_requires_some_evidence(self):
y, f, _ = _confounded_rows(200, 0.0)
Expand Down