Skip to content

Commit f91e6f1

Browse files
cauchyturingclaude
andcommitted
fix: add time-series warning to server.py estimate_effect (sync with copilot.py)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ac044f9 commit f91e6f1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

causal_copilot/mcp/server.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,18 @@ def estimate_effect(
537537
is_linear = bool(diagnosis.get("linearity", True)) if diagnosis else True
538538
is_gaussian = bool(diagnosis.get("gaussian_error", True)) if diagnosis else True
539539

540+
# --- Time-series warning (causal effect estimation assumes i.i.d.) ---
541+
if diagnosis and diagnosis.get("time_series"):
542+
warnings_list: list[str] = [
543+
"Time-series structure detected — causal effect estimation "
544+
"assumes i.i.d. samples. Results may be biased if temporal "
545+
"lag structure matters. Consider time-series-specific methods."
546+
]
547+
else:
548+
warnings_list: list[str] = []
549+
540550
# --- Inference policy (honest gate) ---
541551
graph_kind = classify_graph_kind(adj)
542-
warnings_list: list[str] = []
543552

544553
if graph_kind == "dag":
545554
inference_policy = {

0 commit comments

Comments
 (0)