Fixture

X (N = 5 rows, p = 2 variables), L = 2, stride = 2:

X = [1.0 10.0; 2.0 20.0; 3.0 30.0; 4.0 40.0; 5.0 50.0]
windows(X, 2; stride = 2) = [1.0 2.0 10.0 20.0; 3.0 4.0 30.0 40.0]
starts = [1, 3]

Row i is vec(X[starts[i]:starts[i]+L-1, :]): variable-major, all L offsets of variable 1 then variable 2. The trailing row 5 does not fill a full window and is dropped, not padded.

Point vs window level

M = 1000 windows of length 32 (regime A share ≈ 0.7). Point-level per-variable mean and variance should match across regimes:

variablemean Amean Bvar Avar B
10.0330.0051.181.2
20.0195-0.004130.6630.657
30.041-0.01021.881.9

Energy distance, A vs B, point level: 0.00175

Energy distance, A vs B, window level (flattened, standardized): 0.529

Null scale (two random halves of regime A): point level 0.000271, window level 0.0724

The temporal dependence that distinguishes the regimes is invisible at the point level, where the A-vs-B distance stays within an order of magnitude of the null, and only shows up once each window is kept as one sample, where A-vs-B separates well above the null.

Selectors vs random

n = 100 of M = 1000 windows (L = 32, p = 3), evaluated on the standardized flattened windows. Random: 20 draws; stochastic selectors: 3 seeds.

methodenergy distanceregime-proportion errormean lag-1 autocorrelation
random0.119 ± 0.0180.036 ± 0.0310.13 ± 0.0634
twinning0.06270.020.114
herding · energy0.046600.147
kernel thinning · energy0.0483 ± 0.0004960.00667 ± 0.005770.144 ± 0.0238
support points · energy0.121 ± 0.01670.0533 ± 0.005770.0589 ± 0.0058

datasplit

datasplit(TwinningSplitter(), Zs; standardize = false): 200 of 1000 windows on the test side.

Recovering the original time-series slice for the first 3 selected windows (each stays a separate L × p sample; selected windows are never concatenated):

window 594 (rows 18977:19008):
[-1.0366530634837612 -0.8949494709509489 -1.6978493146942308; 0.9826741714011777 0.9136687735542621 1.2905526228666901; -1.1020468922644833 -0.803930117904336 -0.718832638994183] …
window 617 (rows 19713:19744):
[-0.7940421281103217 -0.21452221218324696 -0.8632301469761647; 0.5143972623539675 1.1973811538814654 0.9065161386430288; -0.2254081865606382 -0.9850816248911023 -1.163538605162607] …
window 399 (rows 12737:12768):
[-1.3307604984135937 -0.9950025789242789 -1.0185232221567513; 0.4456488607770851 0.27963309280792953 1.8241116872239527; -1.005473010961746 -0.6022163614361392 -1.663942434801514] …

Contrast 1: representation below the dependence length

TwinningSplitter, n = 100 of M = 1000 windows, representation built from only the first L_short rows of each length-32 segment, evaluated in the full L = 32 space (dependence length ≈ 1/(1-stay_a) ≈ 16), averaged over 5 independently generated datasets (mean ± sd over data seeds).

L_shortratio to randomregime-proportion error
10.895 ± 0.09640.028 ± 0.0164
20.896 ± 0.2010.024 ± 0.00894
40.854 ± 0.07930.01 ± 0.00707
80.872 ± 0.1590.01 ± 0.01
160.656 ± 0.07380.008 ± 0.011
320.565 ± 0.0340.006 ± 0.00894

Contrast 2: the L·p dimension ladder

M = 2000, n = 200, L ∈ [8, 64, 512, 1024, 4096]. Support points: 3 seeds (min time, mean energy distance); random: 10 draws. The cached energy distance at L = 8 was checked to agree with energydistance directly. "compile seconds" is the first call of that splitter at that width in this process, on a throwaway 60-row matrix; with the matrix brute-force search, compilation is flat from 200 columns on; below that, the k-d tree of select_nearest still pays a width-specific compile (the 192-column rung). Twinning is warmed up first, and the support-point warm-up follows. This ladder runs before Contrast 1 so no ladder width has been compiled earlier in the process.

LL·pmethodcompile secondssecondsenergy distanceratio to random
824random––0.02971
824twinning0.460.010.01120.378
824support points · energy0.150.120.02730.918
64192random––0.09271
64192twinning8.2e-050.0120.05510.595
64192support points · energy1.30.880.080.863
5121536random––0.2451
5121536twinning0.000340.110.20.817
5121536support points · energy0.0031160.2571.05
10243072random––0.3551
10243072twinning0.000630.420.3170.893
10243072support points · energy0.0063650.3430.966
409612288random––0.7061
409612288twinning0.00392.80.6580.932
409612288support points · energy0.023.3e+020.7010.993