Skip to content

Methodology

SergeyGer edited this page Nov 22, 2026 · 1 revision

Methodology

This page summarizes the analytical method defined by the technical specification. Steps 4-6 implement the corresponding pipeline; until then, sections marked planned describe the target contract rather than shipped behaviour.

1. Daily topological signal (Step 4, planned)

At each market close t:

  1. Take W = 60 consecutive session log returns ending at t.
  2. Robustly scale the window: subtract the median, divide by 1.4826 * MAD (median absolute deviation). A missing expected return or zero scale makes the window unavailable.
  3. With embedding dimension m = 3 and lag tau = 2, build vectors x(i) = [z(i), z(i-2), z(i-4)] for every eligible endpoint in the window (56 points).
  4. Compute a Vietoris-Rips filtration on Euclidean distances with Ripser.py, maximum homology dimension 1, coefficients in GF(2), edge-length convention. Store H0/H1 birth-death scales. Ignore intervals of length <= 1e-8 when counting positive features; exclude infinite deaths from finite-lifetime summaries.
  5. Let L(t) be the largest finite H1 lifetime (death minus birth); L(t) = 0 for a valid cloud with no finite H1 pairs. Record finite count and total lifetime for inspection.
  6. Compute D(t) = |L(t) - median(previous 252 valid L values)|, excluding the current observation. Rank D(t) against the previous 252 valid D values with the midrank formula: score = 100 * (below + 0.5 * equal) / 252.
  7. Show "Warming up" until both reference sets are full; after a data gap rebuild a valid 60-return window before scoring again.

Default research controls: window 60, lag 2, dimension 3. Advanced presets: 40/90-session windows, lags 1/3, dimensions 2/4. Custom runs are exploratory and invalidate their cached outputs independently of the frozen warning. Dimensionality, lag, window, metric, normalization and package version are part of the configuration hash; a two-dimensional projection is only a display choice - persistence is always computed on the full analysis coordinates.

2. Industry geometry (Step 5, planned)

  • 12D cloud: 60 consecutive sessions with all 12 decimal industry returns, robust scaling per industry within the window, H0/H1 with the same filtration convention, PCA projection for display (axis labels and explained variance).
  • Mapper: industries represented by their 60-return vectors; Pearson correlation; distance sqrt(2 * (1 - correlation)) clipped to [0, 2]; constant vectors rejected. One-dimensional lens = annualized sample volatility; 3 intervals with width range / 2.2 and stride 60% of the width, endpoints included; within an interval connect industries with distance <= 1.0; each connected component is a node (singletons included); merge nodes with identical member sets; connect nodes sharing an industry; stable layout keyed by sorted member IDs.

3. Warning target and events (Step 6, planned)

  • For a valid origin t, y(t) = 1 when any of the next 20 closes is <= 90% of P(t) (i.e. a fall of at least 10%); otherwise 0. b(t) is the first such breach date; the origin close stays fixed. The last 20 origins are pending until their horizon matures.
  • Episodes: deduplicate b(t) dates; chain consecutive breach dates whose gap is <= 20 index sessions; the first breach date is the episode onset. Keep origin-to-episode membership for audit.
  • Alert matching: an alert counts as early only when its own label is positive and the episode onset occurs 1-20 sessions after the alert; match in date order, at most one alert per episode; an alert during a decline receives no credit for the episode already underway; an unmatched mature alert is a false alert; report unmatched alerts and missed episodes explicitly.

4. Alert policy and baselines (Step 6, planned)

  • Emit an alert when an eligible score meets the locked threshold, subject to a 20-session cooldown.
  • Apply the same rule to the TDA score, VIX close and 20-session annualized realized volatility (sample standard deviation of daily log returns times sqrt(252)).
  • Calibrate one threshold per method on the same eligible validation dates, testing validation percentiles 85, 90, 92.5, 95, 97.5 and 99 of that method's own readings. Freeze the cutoff in the method's units. Preference order: maximum episode recall subject to at most two false alerts per year; then fewer false alerts; then the higher cutoff. If none qualifies, retain a silent comparator and record the reason.
  • Persist each alert with origin, score, cutoff, cooldown state and source snapshot; attach the outcome as a separate record when the horizon matures, so the original prediction stays auditable.

5. Out-of-sample validation (Step 6, planned)

Period Use
1990-2004 Development: inspect data quality, chronological expanding folds; trailing context only from earlier dates
2005-2013 Select fixed thresholds and the stronger simple comparator; rank baselines by the same recall/false-alert/cutoff rules; freeze choices in a run manifest
2014 onward Single frozen test evaluation through the last mature label; calendar-year slices, eligible dates recorded; later parameter changes require a new untouched period or a forward test

Purge the last 20 origins at fit/selection boundaries whenever their outcome reaches the following segment; require full pre-onset history; censor unresolved boundary/end-of-sample episodes and log excluded counts/dates; compare all methods on the intersection of eligible dates.

6. Metrics and evidence wording (Step 6, planned)

  • Report episode recall (numerator/denominator), false alerts per eligible year (eligible sessions / 252), median lead in sessions with range, daily average precision with event prevalence; list every alert and onset; mark precision/lead undefined when the denominator is zero.
  • Paired moving-block bootstrap over 60-session held-out blocks; assign hits/misses to observed onsets and false alarms to alert dates before sampling; reuse the same draws across methods; preserve matches at boundaries; publish the seed, 1,000 replicates and valid replicate counts.
  • Additional diagnostics: return-shuffling control and unscaled-topology ablation.
  • Default wording: "Experimental market anomaly." "Historical early-warning evidence" may be used only when at least five evaluable held-out episodes exist, the lower 95% paired interval for recall gain exceeds zero against the locked comparator, and the held-out false-alert rate stays within two per year and no higher than the comparator's. Otherwise report observed results and the limitation.
  • 2008 is a calibration episode and stays out of held-out success counts. Record future scores before outcomes are known to build prospective evidence; never backdate a live forecast.

7. Reproducibility requirements

  • Configuration hashes cover window/lag/dimension/metric/normalization/package version and the frozen thresholds of an evaluation run.
  • Cached outputs are keyed by snapshot, configuration, algorithm version and window end.
  • A changed future suffix must not change earlier features/scores (causality test).

Clone this wiki locally