trading-platform-ml-engine-v2/models/ATTENTION_TRAINING_REPORT_20260107_033938.md
rckrdmrd 75c4d07690 feat: Initial commit - ML Engine codebase
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>
2026-01-18 04:27:40 -06:00

3.8 KiB

Attention Score Model Training Report

Generated: 2026-01-07 03:39:38

Overview

The attention model learns to identify high-flow market moments using volume, volatility, and money flow indicators - WITHOUT hardcoding specific trading hours or sessions.

Configuration

  • Symbols: GBPUSD
  • Timeframes: 5m, 15m
  • Training Data Cutoff: 2024-12-31
  • Training Years: 5.0
  • Holdout Years: 1.0

Model Parameters

Parameter Value
Factor Window 200
Horizon Bars 3
Low Flow Threshold 1.0
High Flow Threshold 2.0

Features Used (9 total)

Feature Description
volume_ratio volume / rolling_median(volume, 20)
volume_z z-score of volume over 20 periods
ATR Average True Range (14 periods)
ATR_ratio ATR / rolling_median(ATR, 50)
CMF Chaikin Money Flow (20 periods)
MFI Money Flow Index (14 periods)
OBV_delta diff(OBV) / rolling_std(OBV, 20)
BB_width (BB_upper - BB_lower) / close
displacement (close - open) / ATR

Training Results

Model Symbol TF Reg MAE Reg R2 Clf Acc Clf F1 N Train High Flow %
GBPUSD_5m_attention GBPUSD 5m 0.6262 0.1596 59.08% 56.12% 310727 24.3%
GBPUSD_15m_attention GBPUSD 15m 0.6953 0.2534 60.20% 56.62% 104434 35.7%

Class Distribution (Holdout Set)

Model Low Flow Medium Flow High Flow
GBPUSD_5m_attention 6238 (8.4%) 49712 (67.3%) 17951 (24.3%)
GBPUSD_15m_attention 686 (2.8%) 15199 (61.5%) 8830 (35.7%)

Feature Importance

GBPUSD_5m_attention

Rank Feature Combined Importance
1 ATR 0.3542
2 ATR_ratio 0.1580
3 BB_width 0.1348
4 CMF 0.0814
5 MFI 0.0610
6 volume_ratio 0.0604
7 volume_z 0.0552
8 OBV_delta 0.0499
9 displacement 0.0450

GBPUSD_15m_attention

Rank Feature Combined Importance
1 ATR_ratio 0.3374
2 ATR 0.2368
3 volume_z 0.1040
4 volume_ratio 0.0950
5 BB_width 0.0617
6 MFI 0.0460
7 CMF 0.0437
8 displacement 0.0383
9 OBV_delta 0.0370

Interpretation

Attention Score (Regression)

  • < 1.0: Low flow period - below average market movement expected
  • 1.0 - 2.0: Medium flow period - average market conditions
  • > 2.0: High flow period - above average movement expected (best trading opportunities)

Flow Class (Classification)

  • 0 (low_flow): move_multiplier < 1.0
  • 1 (medium_flow): 1.0 <= move_multiplier < 2.0
  • 2 (high_flow): move_multiplier >= 2.0

Trading Recommendations

  1. Filter by attention_score: Only trade when attention_score > 1.0
  2. Adjust position sizing: Increase size when attention_score > 2.0
  3. Combine with base models: Use attention_score as feature #51 in prediction models
  4. Time-agnostic: The model identifies flow without hardcoded sessions

Usage Example

from training.attention_trainer import AttentionModelTrainer

# Load trained models
trainer = AttentionModelTrainer.load('models/attention/')

# Get attention score for new OHLCV data
attention = trainer.get_attention_score(df_ohlcv, 'XAUUSD', '5m')

# Filter trades
mask_trade = attention > 1.0  # Only trade in medium/high flow

# Or use as feature in base models
df['attention_score'] = attention

Files Generated

  • models/attention/{symbol}_{timeframe}_attention/ - Model directories
  • models/attention/trainer_metadata.joblib - Trainer configuration
  • models/attention/training_summary.csv - Summary metrics

Report generated by Attention Model Training Pipeline