- G15: Ring buffer memory optimization (2.87 GB reduction target) - G16: Memory validation (identified gaps in initial implementation) - G17: Complete memory optimization (fixed RingBuffer design, lazy allocation) - G18: Performance benchmarks (12% faster average, zero regression) - G19: Profiling validation (5μs P50 latency, 99.6% fewer allocations) Production readiness: 92% Test coverage: 34/36 tests passing (94.4%) Memory savings: 66% reduction (2.87 GB for 100K symbols) Performance: 5-40% improvement across all benchmarks Modified files: - ml/src/features/normalization.rs (RingBuffer implementation) - ml/src/features/pipeline.rs (lazy bars allocation) - ml/src/features/volume_features.rs (lazy allocation) - adaptive-strategy/src/ensemble/weight_optimizer.rs (regime Sharpe) - ml/src/tft/mod.rs (225-feature support)
111 lines
2.8 KiB
Markdown
111 lines
2.8 KiB
Markdown
# Agent G9: TFT 225-Feature Update - Quick Reference
|
|
|
|
**Status**: ✅ COMPLETE
|
|
**Date**: 2025-10-18
|
|
|
|
---
|
|
|
|
## What Changed
|
|
|
|
### 1. Training Script (`ml/examples/train_tft_dbn.rs`)
|
|
- ✅ Added `FeatureConfig::wave_d()` initialization
|
|
- ✅ Updated `convert_to_tft_data()` to accept feature config
|
|
- ✅ Changed historical features from 50 → 225 per timestep
|
|
- ✅ Updated array shape: `(lookback_window, 50)` → `(lookback_window, 225)`
|
|
- ✅ Added Wave D features (indices 201-224, 24 features)
|
|
|
|
### 2. Trainer Config (`ml/src/trainers/tft.rs`)
|
|
- ✅ Updated `num_unknown_features: 50` → `225`
|
|
- ✅ Updated checkpoint naming: `tft_epoch_{}` → `tft_225_epoch_{}`
|
|
|
|
---
|
|
|
|
## Feature Breakdown (225 Total)
|
|
|
|
| Range | Category | Count | Description |
|
|
|-------|----------|-------|-------------|
|
|
| 0-200 | Wave C | 201 | OHLCV, technicals, microstructure, statistical |
|
|
| 201-210 | CUSUM | 10 | Structural break detection |
|
|
| 211-215 | ADX | 5 | Directional indicators |
|
|
| 216-220 | Transitions | 5 | Regime transition probabilities |
|
|
| 221-224 | Adaptive | 4 | Position sizing, stop-loss, Sharpe |
|
|
|
|
---
|
|
|
|
## Run Commands
|
|
|
|
```bash
|
|
# Compile check
|
|
cargo check -p ml --example train_tft_dbn
|
|
|
|
# Test compilation
|
|
cargo test -p ml --example train_tft_dbn --no-run
|
|
|
|
# Training (20 epochs, default)
|
|
cargo run -p ml --example train_tft_dbn --release
|
|
|
|
# Custom training
|
|
cargo run -p ml --example train_tft_dbn --release -- \
|
|
--epochs 50 \
|
|
--batch-size 32 \
|
|
--lookback 60 \
|
|
--horizon 10
|
|
```
|
|
|
|
---
|
|
|
|
## Validation Checklist
|
|
|
|
- ✅ Zero compilation errors
|
|
- ✅ Feature count: 225 (verified via `feature_config.feature_count()`)
|
|
- ✅ Historical features shape: `[60, 225]`
|
|
- ✅ Checkpoint naming: `tft_225_epoch_{epoch}.safetensors`
|
|
- ✅ Tests updated: `test_convert_to_tft_format()`
|
|
|
|
---
|
|
|
|
## Expected Output
|
|
|
|
```
|
|
Configuration:
|
|
• Feature count: 225 (Wave D: Wave C 201 + Wave D 24)
|
|
• Hidden dimension: 256
|
|
• Lookback window: 60
|
|
• Forecast horizon: 10
|
|
```
|
|
|
|
---
|
|
|
|
## Files Modified
|
|
|
|
1. `ml/examples/train_tft_dbn.rs` (~150 lines)
|
|
2. `ml/src/trainers/tft.rs` (2 lines)
|
|
|
|
---
|
|
|
|
## Next Steps
|
|
|
|
1. **Dry run**: `cargo run -p ml --example train_tft_dbn --release -- --epochs 1`
|
|
2. **Full training**: 50 epochs on ES.FUT data
|
|
3. **Multi-symbol**: Train on ES.FUT, NQ.FUT, 6E.FUT, ZN.FUT
|
|
4. **Replace proxies**: Integrate real regime features (Agents D13-D16)
|
|
|
|
---
|
|
|
|
## Key Metrics
|
|
|
|
- **Compilation**: ✅ 0 errors, 66 warnings (non-critical)
|
|
- **Input dimension**: 225 features (4.5x from 50)
|
|
- **Expected inference**: ~3.5ms (target: <5ms)
|
|
- **Expected GPU memory**: ~180MB training (440MB total budget)
|
|
|
|
---
|
|
|
|
## Notes
|
|
|
|
⚠️ Wave D features (201-224) are currently **proxy features** derived from OHLCV. They will be replaced with actual regime detection features from Agents D13-D16 in Phase 4.
|
|
|
|
---
|
|
|
|
**Report**: `AGENT_G9_TFT_225_FEATURES_IMPLEMENTATION_REPORT.md`
|