learn_cause_weights
Derive per-site cause weights from confirmed incident history, adapting downtime root cause analysis to your site's evidence with explainable, anti-overfit precision.
Instructions
[READ][risk=low] Learn a per-site RCA {cause: weight} profile from history.
Derives a per-site cause-weight profile from a corpus of CONFIRMED past
incidents so downtime_root_cause adapts to what THIS site's evidence actually
predicts. Pure + explainable: each weight is the smoothed signal→cause
precision relative to chance (>1 = evidence for that cause is reliable here,
<1 = often misleading) — no black box. Anti-overfit: Laplace smoothing + a
per-cause min-sample guard, and a fall-back to the shipped defaults when the
corpus is too thin. Feed the returned 'cause_weights' to downtime_root_cause's
cause_weights argument. Advisory: it tunes ranking, never executes anything.
Args:
history: Confirmed incidents — [{cause, signals:[...]}] where 'cause' is the
known root cause and 'signals' are the cause labels the evidence pointed
at (both from the copilot taxonomy: mechanical_fault, comms_loss,
sensor_fault, material_starvation, quality_reject, changeover, utility_fault).
min_samples: Minimum confirmed incidents before adapting at all (default 8);
below it the defaults are kept.
smoothing: Laplace pseudo-count pulling each estimate toward chance (default 1.0).
Returns dict: {cause_weights:{cause: multiplier}, n_incidents, per_cause:{cause:
{support, hits, precision, weight, note}}, rationale}.
Example: learn_cause_weights(history=[{"cause":"mechanical_fault",
"signals":["mechanical_fault"]}, {"cause":"comms_loss","signals":["comms_loss"]}]).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| history | Yes | ||
| smoothing | No | ||
| min_samples | No |