Causal Reasoning
causal

Estimate Causal Effect

Estimate causal effects using do-calculus (Pearl's do-operator).

Computes E[Y | do(X=x)] - "the expected Y if we intervene to set X"

Differs from observational inference P(Y|X) because interventions break confounding. Eliminates backdoor paths and estimates true causal effect.

Why This Matters

Optimal decision-making requires causal effects:

  • "If I change X, how much will Y improve?"
  • "What's the causal impact (not just correlation)?"
  • Avoids Simpson's paradox and confounding errors

Classical example: Treatment A correlates with worse outcomes, but has positive causal effect. Do-calculus distinguishes these.

Args: treatment: Intervention variable outcome: Outcome to measure current_user: Authenticated user db: Database session

Returns: Causal effect estimate and number of paths considered

Example: ``` Treatment: "increased_context_window" Outcome: "task_success_rate"

Returns:
{
    "treatment": "increased_context_window",
    "outcome": "task_success_rate",
    "causal_effect": 0.23,
    "num_paths": 5
}

Interpretation: Interventional increase in context window causally
increases task success by 23 percentage points.
```
get/api/v1/causal/do-calculus

Request

  • The document declares no server URL.
  • Auth: HTTP bearer

Query parameters

treatmentstring required

Intervention variable

outcomestring required

Outcome to measure

Headers

X-API-Keystring nullable

Response

Successful Response

treatmentstring required
outcomestring required
causal_effectnumber required
num_pathsinteger

Changes

No recorded changes to this operation across all 2 revisions of this API.