M/03 · Topological Data Analysis(拓撲資料分析)
策略相關性結構上的持續性條碼
在相關性距離的 Vietoris–Rips 過濾下計算 H₀ 持續同調:計數一個策略族群中有多少穩定群集得以存續。
數學原理
取 N 個具報酬歷史 ri ∈ ℝT 的策略。定義相關性距離
它就是兩個報酬向量之單位範數代表之間的歐氏距離;它是一個真正的度量(Mantegna 1999)。在 ε = 0 時,每個策略各自成為一個群集,共 N 個連通分量。當 ε 增長時,我們為每一對滿足 d(i, j) ≤ ε 的策略加入一條邊。Vietoris–Rips 複形 VRε 是一個單純複形,其 k-單純形即為此圖中的 (k+1)-團;對 H₀ 而言,我們只需要它的 1-骨架(亦即該圖本身)。
VRε 的連通分量以併查集(union-find)追蹤。隨著 ε 增大,我們得到一個巢狀的圖序列
每一條新邊要嘛 (a) 連接兩個已位於同一分量的頂點(H₀ 不變),要嘛 (b) 將兩個分量合併為一。在情況 (b) 中,較年輕的分量在 ε 處「死亡」。持續性將此形式化:每個分量都在 ε = 0 處誕生,並在合併時刻死亡。第 0 階持續性圖為
亦即 N − 1 條有限條,以及一條不朽條(最終吞併一切的那個分量)。條碼不過就是把這個集合畫成一條條水平線段。
穩定群集計數
長條對應於那些在一段很長的 ε 範圍內抵抗被吸收的群集,意味著該條附近任何合理的閾值都會以相同方式劃分族群。對「穩定群集數目」的一個標準啟發式為
其中 c 約在 1.5–2.0;+1 計入不朽條。更為嚴格的替代方案包括:在自助重抽(bootstrap)下相對擾動後條碼的瓶頸距離(bottleneck distance),這正是我們在生產流程中所回報的。
實例演算
三個各含 8 個策略的植入群集,群集內 ρ = 0.6,T = 250 根 K 棒。隨著 T 增長,群集內的經驗相關性以機率 1 集中於 0.6 附近(故 d ≈ √(2·0.4) ≈ 0.89),而跨群集的相關性集中於 0 附近(d ≈ √2 ≈ 1.41)。預期的條碼:
- 21 條短條在 ε ≈ 0.89 附近死亡(21 次群集內合併)。
- 2 條長條在 ε ≈ 1.41 附近死亡(2 次跨群集合併)。
- 1 條不朽條。
K* = 1 + 2 = 3,與真實情況相符。下方的示範重現了這個實驗。
Demo: H0 persistence barcode
3 planted clusters of 8 strategies each. Pairwise correlation distance d(i,j)=√(2(1−ρ)). Barcode: when each connected component merges into a larger one.
Each horizontal bar is one connected component, born at ε=0 and dying when it merges with another component. Amber bars are persistent, they survive past 1.5× the median merge-distance. Their count + 1 (the immortal component) ≈ the number of stable clusters in the population.
圖表
為何這對系統性策略至關重要
群集計數是一個被低估的機制指標。在良性市場中,策略族群會分解為數個正交風格的穩定群集,長條十分常見。在受壓機制下,跨群集相關性上升,群集內相關性上升得更多,條碼便塌縮為一兩條長條:一切都一起交易。由 H₀ 條碼導出的整數 K*,會在這場塌縮顯現於頭條投組統計量之前就預先示警。
在運作上,我們將 M/03 與 M/01(RMT 特徵譜)並行執行。MP 訊號特徵值的計數給出有效因子數目的上界;H₀ 持續群集計數則給出有效風格數目的下界。兩者應當同步。當它們發散時,通常是因為單一因子在驅動一切,那便是一個警訊。
可重現性
DaruFinance / strategy-tda
Python · 開源參考實作
最小調用
import numpy as np
from strategy_tda import h0_barcode_from_returns
# X: N x T strategy returns matrix
bars = h0_barcode_from_returns(X)
# bars is an array of shape (N-1, 2): [birth, death] for each merge
# H0 is born at 0; long bars indicate stable clusters.
n_robust_clusters = sum(d > 1.5 * np.median(bars[:, 1]) for d in bars[:, 1]) + 1
參考文獻
- [1]Edelsbrunner, H., Letscher, D. & Zomorodian, A. (2002). Topological persistence and simplification. Discrete & Computational Geometry 28, 511–533.
- [2]Carlsson, G. (2009). Topology and data. Bulletin of the AMS 46, 255–308.
- [3]Gidea, M. & Katz, Y. (2018). Topological data analysis of financial time series: landscapes of crashes. Physica A 491, 820–834.
- [4]Mantegna, R. N. (1999). Hierarchical structure in financial markets. European Physical Journal B 11, 193–197.

