Three things landing atomically because they're load-bearing for each other: 1. **Trend-scanning leakage fix** — trend_scanning.rs was emitting OLS slope+t-stat over a *forward* window [t, t+L]. With the Phase 1a label = sign(price[t+60] − price[t]), the forward feature window overlaps the label window, contaminating it. Purged walk-forward only sterilizes forward-looking *labels* that cross the train/val split, not forward-looking *features* that peek inside the same horizon the label measures. The leak inflated MLP accuracy from 0.49 (legacy 74-dim baseline) to 0.75 — vanished to 0.50 after switching to a trailing window. Bounded the perfect-fit t-stat sentinel from ±1e6 → ±20 (p<1e-30 is already meaningless); eliminated the 16k corruption-cap drops. 2. **Variable-dim alpha column** — fxcache schema now carries the alpha-feature width via metadata (`alpha_feature_dim`), not a compile-time constant. Same on-disk format hosts the 134-dim bar-level stack OR the 81-dim snapshot stack. Reader + auto-detect honor the metadata-declared dim; downstream MLP auto-sizes `in_dim`. Single schema, no forks. 3. **Snapshot pipeline (Phase 1c falsification)** — `snapshot_pipeline.rs`: 81-dim per-MBP10-snapshot extractor reusing 10 snapshot-native alpha blocks + 6 new snapshot-specific features (time-since-trade, time-since-snap, event-rate, spread-bps, L1-imbalance, microprice-mid drift). `precompute_features` gets `--row-unit snapshot` flag; emits one fxcache row per LOB update (1.97M rows from MBP-10 data vs 206K for bar mode). **Smoke verdict on real data** (ES.FUT, 1.97M snapshots, 384K val): - Bar-level honest alpha: accuracy=0.5005, AUC=0.5043 (no signal) - **Snapshot-level alpha**: accuracy=0.5241, AUC=0.6849 (real signal, 384K val) - GBM corroboration: accuracy=0.5401 (non-linear partitioning sees more) - Horizon decay: alpha peaks at K=20-50 snapshots (~5-25ms), gone by K=500 - Regime-conditional: spread-Q4 quintile hits 0.752 accuracy on 76k samples Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
55 lines
1.3 KiB
TOML
55 lines
1.3 KiB
TOML
[package]
|
|
name = "ml-features"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
authors.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
homepage.workspace = true
|
|
documentation.workspace = true
|
|
publish.workspace = true
|
|
keywords.workspace = true
|
|
categories.workspace = true
|
|
description = "Feature engineering for Foxhunt ML models"
|
|
|
|
[features]
|
|
default = []
|
|
|
|
[dependencies]
|
|
# Internal workspace crates
|
|
ml-core.workspace = true
|
|
common.workspace = true
|
|
data = { path = "../data" }
|
|
# Alpha Block M (fractional differentiation): reuse `FractionalCoeffs` from
|
|
# ml-labeling instead of duplicating the binomial-coefficient math.
|
|
# ml-labeling only depends on ml-core, so this adds no new transitive weight.
|
|
ml-labeling.workspace = true
|
|
|
|
# Serialization and error handling
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_json.workspace = true
|
|
bincode.workspace = true
|
|
anyhow.workspace = true
|
|
chrono.workspace = true
|
|
chrono-tz = "0.10"
|
|
tracing.workspace = true
|
|
once_cell = "1.19"
|
|
|
|
# Async and parallelism
|
|
tokio.workspace = true
|
|
rayon.workspace = true
|
|
|
|
# Data loading (DBN/Databento)
|
|
dbn = "0.42"
|
|
zstd.workspace = true
|
|
rand.workspace = true
|
|
|
|
[dev-dependencies]
|
|
tokio = { workspace = true, features = ["test-util", "macros"] }
|
|
approx.workspace = true
|
|
toml.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|