Classifying 0/0 Limits — Model-Chooser (conservative, penalized) (4B)

Purpose. When a pure power law is borderline or inadequate, select among simple local families with a penalized fit score. Keep the magnitude decision conservative; never overstate.

Families (near x0).

1) Power:        h(x) ~ c * |x - x0|^p
2) Power*log:    h(x) ~ c * |x - x0|^p * L(x)^q,   L(x) := log(1/|x - x0|)
3) Essential*:   h(x) ~ c * exp( -alpha * |x - x0|^(-r) ),  alpha>0, r>0   (*rare, guarded)

Use (3) only when pathology suggests essential-type flatness or blow-up that powers cannot capture.

Fitting lenses (ASCII). Use only samples with x != x0 and |h| > 0. Natural log implied.

# 1) Power (lens):
t := log|x - x0|;  y := log|h|
fit: y = (log|c|) + p*t   -> slope p, intercept log|c|

# 2) Power*log (two-step lens):
estimate p via Power lens
z := log L(x) = log( log(1/|x - x0|) )
y2 := log|h| - p*log|x - x0|
fit: y2 = (log|c|) + q*z   -> slope q, intercept log|c|

# 3) Essential (scanned lens):
choose small grid r_guess in {0.5, 1.0, 1.5}
s := |x - x0|^(-r_guess);  yE := -log|h|
fit: yE = alpha*s + const   -> slope alpha >= 0

Unified scoring scale (AIC/BIC on y = log|h|). Regardless of lens used to estimate parameters, evaluate predictions on the same scale:

Power:      y_hat = log|c| + p*log|x - x0|
Power*log:  y_hat = log|c| + p*log|x - x0| + q*log log(1/|x - x0|)
Essential:  y_hat = log|c| - alpha*|x - x0|^(-r)

e := y - y_hat
RSS := sum(e^2)
AIC = 2*k + n*log(RSS/n)
BIC = k*log(n) + n*log(RSS/n)

Parameter counts (typical).

Power: k = 2          # c, p
Power*log: k = 3      # c, p, q
Essential: k = 2      # per fixed r_guess (intercept encodes c, plus alpha)

Optional grid penalty: if you scan G distinct r_guess, add a small penalty (e.g., +log G to BIC or +2 to AIC) to remain conservative.

Minimal knobs (declare once; override only if you know better).

score_fn      = BIC
delta_score   = 2.0      # scores closer than this are a tie
R2_min        = 0.85
r_grid        = {0.5, 1.0, 1.5}    # used only if pathology suggests essential

Lite mode (recommended default).

families considered: Power, Power*log
essential: disabled unless pathology = true
tie handling: use near-tie thresholds from 4A (T_p, T_q) after parameter estimation
defaults: T_p = 1e-3, T_q = 1e-3   # declare in manifest

Windowing rule (for f/g comparability). Fit f and g on identical neighborhoods/radii and sample points whenever possible; otherwise set REG = MULTI and print the conservative headline.

MULTI policy (model ambiguity).

If >=2 families tie within delta_score:
  REG = MULTI
  headline class: prefer ZERO over FINITE over INF  # conservative total order
  downstream can disambiguate with more data; do not overstate

Decision logic (magnitude first, then alignment).

1) Fit families 1–2 for both f and g. Consider 3) only if pathology warrants.
2) If a single family wins by > delta_score, decide magnitude using that family’s params:
   - Power / Power*log: apply 0over0 rule with (p_f,q_f) vs (p_g,q_g)
     (lexicographic on (Delta_p, Delta_q), using near-tie thresholds if declared)
   - Essential (rare): if both f and g fit essential with same r (within tie), compare alphas:
       if alpha_f > alpha_g -> < 0 , a_div >
       if alpha_f = alpha_g -> < c_f / c_g , a_div >   # track signs in c_f,c_g
       if alpha_f < alpha_g -> < s * inf , a_div >,  s := sign(c_f/c_g)
   If only one side appears essential or r orders disagree -> REG = MULTI (headline conservative).
3) If ties remain or families disagree in class:
   - set REG = MULTI
   - headline: conservative class using ZERO < FINITE < INF
   - optional audit: print per-family one-liners with (model, params, score deltas)
4) Alignment channel (metadata only):
   a_div = tanh( atanh(a_f) - atanh(a_g) )   # clamp before atanh
   do not let model disagreement change the headline magnitude
   optional stability: report STAB[%] from bootstrap-over-families (separate from a_div)

Sign tracking. While lenses operate on |h|, always track signs separately from raw h. For INF, use DIR+ / DIR- per sign(c_f / c_g).

Print guidance.

# Single-winner:
< m_out , a_div >
SSMS: {CLASS}@{A-tag}  DIV[a_div]@{A-tag}  {DIR?}

# Disagreement/tie:
Headline: SSMS: {CLASS_conservative}  DIV[a_div]@{A-tag}  REG=MULTI
Audit (optional, separate lines):
POWER:      {CLASS_p}  score=...
PWR*LOG:    {CLASS_pl} score=...
ESSENTIAL:  {CLASS_e}  r=... score=...

Safety and fallbacks.

Clamp before rapidity ops: a := clamp(a, -1 + eps_a, +1 - eps_a)   # default eps_a = 1e-6
If no family passes R2_min and nested windows show non-shrinking variance:
   REG = OSC (oscillatory) or REG = MULTI (NOFIT) rather than forcing a magnitude
Sided behavior:
   run chooser on left (x<x0) and right (x>x0) separately
   if classes differ -> REG = SIDED and print both one-sided results

Notes on signs and lexicographic consistency.

Magnitude and INF sign follow sign(c_f / c_g).
Lexicographic precedence is preserved: powers (p) dominate logs (q).
Chooser estimates (p,q); classification follows the lexicographic rule on (Delta_p, Delta_q).


Navigation
Prev: Classifying 0over0 Limits — Extended Asymptotics (log modifiers) (4A)
Next: Classifying 0over0 Limits — Practitioner Pipeline (step-by-step) (5)