Skip to content

做什么(One-liner)

三合一市场临界性启发式:相关性上升 × 波动压抑 × 厚尾回归 → 加权 fragility 分 [0, 1]。自我声明 'not production risk model',用作 Canvas 市场状态 visual 指标。

怎么用

Canvas 拖 b0_criticality_v1,上游接 price_factor_v1 节点(Canvas 自动转成 returns),可选手填 correlations 矩阵。典型用法:

price_factor → b0_criticality_v1 (returns auto) → reflexivity_detector_v1

                        (multi-asset) correlations → cross-asset fragility overlay

核心公式

# 三个独立 gated 分量:
avg_corr  = mean(upper_tri(correlations))         if len >= 2
vol       = std(returns) * sqrt(252)              if len > 10
suppr     = 1 - min(1, vol / (max|r|*sqrt(252)+1e-9))
tail_α    = -slope(log(rank) vs log(sort_desc(top-10%|r|)))  if tail > 5

# Weighted composite (capped 1.0):
fragility = 0.40 * max(0, avg_corr)
          + 0.35 * suppr
          + 0.25 * min(1, tail_α / 5.0)
          |> min(1.0, _) |> round(4)

Rounding 契约:所有数字字段 round(4);fragility 严格 [0, 1]。

Gating 契约:输入不满足阈值时,对应字段完全缺失(非 None)。

假设与适用场景

假设:daily 频率(sqrt(252) 年化)+ correlation 对称矩阵 + 子集权重 ad-hoc + tail log-rank 近似。

适用:Canvas 市场临界 visual 指标、教学 demo、跨资产 fragility overlay 输入。

不适用:生产级 VaR、intraday、Hill-level 尾指数估计、≤10 观察点、monthly/weekly 频率。

输入 / 输出契约

{returns?, correlations?}{_method, fragility_composite_0_1 (always), avg_pairwise_correlation?, realized_vol_annualized?, vol_suppression_index_0_1?, tail_decay_exponent_proxy?}gated fields missing when input insufficient

已知局限

  1. Self-declared heuristic_method 字段明示 'not production risk model'
  2. Suppression 用 whole-sample max(字段名 "rolling_max" 误导 — 不是真 rolling)
  3. Tail α 用 naive log-rank regression(Hill MLE 未实现)
  4. 权重 0.40 / 0.35 / 0.25 ad-hoc(无实证校准)
  5. sqrt(252) 硬编码(非日频输入会系统偏差)
  6. Correlation matrix PSD / symmetric 不校验
  7. Gated fields 缺失(非 None):客户端必须 if 'field' in result: 容错
  8. n=1 corr → avg_pairwise_correlation 字段不出现
  9. len(returns) ≤ 10 → vol / suppression / tail 字段全部缺失

参考文献

Scheffer et al. (2009) Early-warning signals for critical transitions (Nature) + Preis et al. (2012) Correlations under stress (Sci Reports) + Clauset-Shalizi-Newman (2009) Power-law distributions (SIAM Review)。详见 frontmatter。

Golden Test

tests/golden/fixtures/tier3/b0_criticality/numpy_manual 跨实现(reference_compute.py 独立 numpy 重现 + b0_6_criticality 捕获时相互 assertion)。1e-10 tolerance。11 tests:

  • matches_snapshot — 6 cases (fragile / benign / returns-only / too-few / n=1 corr / no-input) byte-equal
  • determinism — 5 reruns 一致
  • avg_corr_upper_triangular_mean — 3x3 matrix 已知 off-diagonal → 0.6 精确
  • n_equals_one_no_avg_corr — [[1.0]] → avg_pairwise_correlation 字段缺失
  • returns_too_short — len=10 → vol / suppression 字段缺失
  • returns_eleven_activates_branches — len=11 边界
  • fragility_composite_bounded_0_1 — 极端输入均在 [0, 1]
  • no_inputs_returns_zero_fragility — 全 None → fragility = 0.0
  • method_field_locked_method 永远带 heuristic 声明
  • rounding_contract — 所有数字字段 round(4)
  • weight_contract — 已知 avg_corr=0.85 → fragility = 0.34 精确(权重 0.40 锁定)

Changelog

  • 1.0.0 (2026-04-20) — 首次 Active(Tier 3 batch 1.2, cross-impl numpy_manual)

Verifiable intelligence for the decisions that demand scrutiny.