Rewrite 7 crate READMEs to reflect current architecture: correct model types (DQN/PPO/TFT/Mamba2), AtomicKillSwitch, real EnsembleConfig source from ml, actual data crate purpose, web-dashboard project details, ml_training_service ports. Fix 5 api_gateway/TLI docs: strip swarm agent framing, update service endpoints to api_gateway:50050, remove deleted dashboard references and hardcoded paths. Add missing web-gateway/README.md documenting 24 REST endpoints, WebSocket support, JWT auth, and 3-tier rate limiting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
2.0 KiB
Markdown
50 lines
2.0 KiB
Markdown
# ml
|
|
|
|
Machine learning models for Foxhunt.
|
|
|
|
## Models
|
|
|
|
- **DQN (Rainbow)** -- Deep Q-Network with prioritized experience replay, dueling heads, noisy nets, double Q-learning
|
|
- **PPO** -- Proximal Policy Optimization with GAE, LSTM policies, clip-higher option
|
|
- **TFT** -- Temporal Fusion Transformer for multi-horizon time series forecasting
|
|
- **Mamba2** -- State space model for efficient sequence prediction
|
|
- **Liquid Networks** -- Biologically inspired neural networks for non-stationary data
|
|
- **TLOB** -- Transformer-based Limit Order Book analysis
|
|
- **Flash Attention** -- Optimized attention implementation
|
|
|
|
## Training
|
|
|
|
Two paths per model:
|
|
|
|
1. **Standalone trainer** -- direct training loop (e.g., `DQN::train`, `PpoTrainer`)
|
|
2. **UnifiedTrainable adapter** -- wraps models for the hyperopt pipeline (e.g., `DQNTrainableAdapter`, `UnifiedTrainablePPO`)
|
|
|
|
## Inference
|
|
|
|
`InferenceAdapterBridge` connects models to the ensemble coordinator in `adaptive-strategy`. Each model exposes an `InferenceAdapter` trait for prediction.
|
|
|
|
## Backend
|
|
|
|
- **Candle v0.9.1** -- `VarMap`, `AdamW`, `loss.backward()`, `GradStore`, `opt.step(&grads)`
|
|
- **CUDA required for training** -- tested on RTX 3050 Ti 4GB, max batch size 230
|
|
- **CPU inference** supported
|
|
|
|
## Hyperopt
|
|
|
|
`ArgminOptimizer` (Particle Swarm Optimization) with per-model adapters:
|
|
DQN, PPO, ContinuousPPO, TFT, Mamba2. Uses `ParameterSpace` trait for continuous parameter mapping.
|
|
|
|
## ModelType Enum
|
|
|
|
15 variants: `CompactDQN`, `DistilledMicroNet`, `DQN`, `RainbowDQN`, `MAMBA`, `TFT`, `TGGN`, `LNN`, `TLOB`, `PPO`, `Transformer`, `Mamba`, `LiquidNet`, `TGNN`, `Ensemble`.
|
|
|
|
## Key Modules
|
|
|
|
`dqn`, `ppo`, `tft`, `mamba`, `liquid`, `tlob`, `flash_attention`, `ensemble`, `evaluation`, `inference`, `trainers`, `hyperopt`, `checkpoint`, `preprocessing`, `data_loaders`, `features`, `model_factory`, `training_pipeline`, `regime_detection`, `stress_testing`, `validation`, `bridge`, `common`, `metrics`.
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
SQLX_OFFLINE=true cargo test -p ml --lib # ~2009 tests
|
|
```
|