Two-channel lens, robust stats, and a tiny 5×5 micro-grid — copy-paste.
I4) Two-channel quick builder (support vs penalty)
Map supportive and penalizing evidence separately for clarity and sign-sanity. Use the same c chosen earlier; scale each side by its own Unit.
# Inputs: e_out := sum_i alpha_i * P_i # supportive cues
# e_in := sum_j beta_j * N_j # penalties
Unit_out := p95(e_out); Unit_in := p95(e_in)
a_out := tanh( +c * e_out / max(Unit_out, 1e-12) )
a_in := tanh( -c * e_in / max(Unit_in, 1e-12) )
# Chooser (bounded, order-invariant)
U_in := sum( w * atanh( clamp(a_in, -1+eps_a, 1-eps_a) ) )
V_out := sum( w * atanh( clamp(a_out, -1+eps_a, 1-eps_a) ) )
W := sum( w )
RSI := tanh( (V_out - U_in) / max(W, eps_w) ) # decision index
RSI_env := g_t * RSI # or tanh(g_t * atanh(RSI))
Notes.
- Sign sanity: increasing
e_outraisesa_out; increasinge_inlowers alignment viaa_in. - Comparability: keep
cfixed; declareUnit_out,Unit_in, andwin the manifest. - Parity: classical values are unchanged:
phi((m,a)) = m.
I5) Robust stats option (when tails are ugly)
Heavy tails? Use median/MAD to stabilize Unit and keep saturation sane.
# Robust Unit from raw e (single-channel)
median_e := median(e_raw)
MAD := median( |e_raw - median_e| )
Unit := 2.5 * max(MAD, 1e-12) # robust scale
# Then reuse earlier c (or re-solve once for your boundary)
a := tanh( c * (e_raw / max(Unit, 1e-12)) )
# Quick health checks
sat := mean( |c*e_raw/Unit| > 3.0 ) # target < 0.10
dead := mean( |c*e_raw/Unit| < 0.10 ) # target < 0.70
Tip. If sat is high, raise Unit; if dead is high, lower Unit or modestly increase c.
I6) Micro-grid for Unit and c (5×5, five minutes)
A tiny grid lands you near-optimal separability without tuning debt.
# Candidate Units from percentiles of |e_raw|
Units := { p75, p85, p90, p95, p98 } of |e_raw|
# For each Unit, try two targets for c
for Unit in Units:
e_norm := e_raw / max(Unit, 1e-12)
c_Ap := atanh(0.60) / max(p95(|e_norm|), 1e-12) # A+ boundary at p95
c_App:= atanh(0.90) / max(p95(|e_norm|), 1e-12) # A++ boundary at p95
for c in {c_Ap, c_App}:
a := tanh( c * e_norm )
# Score (observation-only):
sep := band_share("A+", a) - band_share("A-", a) # separation
stab := -stdev_weekly_RSI(a, w) # stability
corr := corr_with_KPI(a, KPI_proxy) # optional
score := 0.6*sep + 0.3*stab + 0.1*corr
keep best by score (break ties by simpler Unit)
Publish once: chosen Unit, c, weights, eps_a, eps_w, bands, and knobs_hash. From then on, runs are comparable across teams and vendors.
One-line takeaway. Separate support vs penalty with a two-channel lens, stabilize tails with MAD, and lock choices via a 5×5 micro-grid—yielding a bounded, portable lens that fuses order-invariantly while phi((m,a)) = m keeps your numbers pristine.
Navigation
Previous: SSM-AI – Appendix I — Lens Builder (I1–I3)
Next: SSM-AI – Appendix I — Lens Builder (I7–I9)
Directory of Pages
SSM-AI — Table of Contents