Hierarchical ML Pipeline for trading predictions:
- Level 0: Attention Models (volatility/flow classification)
- Level 1: Base Models (XGBoost per symbol/timeframe)
- Level 2: Metamodels (XGBoost Stacking + Neural Gating)
Key components:
- src/pipelines/hierarchical_pipeline.py - Main prediction pipeline
- src/models/ - All ML model classes
- src/training/ - Training utilities
- src/api/ - FastAPI endpoints
- scripts/ - Training and evaluation scripts
- config/ - YAML configurations
Note: Trained models (*.joblib, *.pt) are gitignored.
Regenerate with training scripts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.4 KiB
2.4 KiB
Reduced Features Model Training Report
Generated: 2026-01-05 02:48:25
Feature Set (14 Features)
| Category | Features |
|---|---|
| OHLCV | open, high, low, close, volume |
| Volatility | ATR |
| Trend | SAR |
| Momentum | RSI, MFI |
| Volume Flow | OBV, AD, CMF |
| Volume Derived | volume_z, volume_anomaly |
Training Configuration
- Training Data Cutoff: 2024-12-31 (2025 reserved for backtesting)
- Volatility Weighting: Enabled (softplus, beta=4.0, w_max=3.0)
- XGBoost: n_estimators=300, max_depth=6, lr=0.03
Results Summary
| Model | MAE | RMSE | R2 | Dir Accuracy | Train | Val |
|---|---|---|---|---|---|---|
| XAUUSD_5m_high_h3 | 1.045258 | 1.475188 | -0.3217 | 90.80% | 288324 | 50881 |
| XAUUSD_5m_low_h3 | 1.063084 | 1.446926 | -0.5373 | 93.93% | 288324 | 50881 |
| XAUUSD_15m_high_h3 | 2.267892 | 2.942058 | -0.7100 | 90.19% | 96996 | 17117 |
| XAUUSD_15m_low_h3 | 2.569684 | 3.704750 | -2.3699 | 96.30% | 96996 | 17117 |
| EURUSD_5m_high_h3 | 0.000323 | 0.000440 | -0.1927 | 97.80% | 313800 | 55377 |
| EURUSD_5m_low_h3 | 0.000316 | 0.000463 | -0.1206 | 97.63% | 313800 | 55377 |
| EURUSD_15m_high_h3 | 0.000585 | 0.000784 | -0.2201 | 98.22% | 105179 | 18561 |
| EURUSD_15m_low_h3 | 0.000588 | 0.000796 | -0.1879 | 98.26% | 105179 | 18561 |
| BTCUSD_5m_high_h3 | 1.393661 | 1.737558 | -0.5381 | 67.02% | 46353 | 8181 |
| BTCUSD_5m_low_h3 | 1.033284 | 1.597519 | -0.0556 | 71.96% | 46353 | 8181 |
| BTCUSD_15m_high_h3 | 2.496958 | 2.910765 | -1.5975 | 76.47% | 24036 | 4242 |
| BTCUSD_15m_low_h3 | 2.439187 | 3.141698 | -1.6392 | 80.79% | 24036 | 4242 |
Usage Example
import joblib
from config.reduced_features import generate_reduced_features
# Load model
model_high = joblib.load('models/reduced_features_models/XAUUSD_15m_high_h3.joblib')
model_low = joblib.load('models/reduced_features_models/XAUUSD_15m_low_h3.joblib')
# Prepare features
features = generate_reduced_features(df_ohlcv)
feature_cols = ['ATR', 'SAR', 'RSI', 'MFI', 'OBV', 'AD', 'CMF', 'volume_z', 'volume_anomaly']
X = features[feature_cols].values
# Predict
pred_high = model_high.predict(X)
pred_low = model_low.predict(X)
Notes
- Models trained on data up to 2024-12-31
- 2025 data reserved for out-of-sample backtesting
- Volatility-biased weighting emphasizes high-movement samples
- Reduced feature set (14) for better generalization
Report generated by Reduced Features Training Pipeline