Scripts: - Update ingest_ohlcv_polygon.py for improved data processing Reports: - Add attention model training reports (2x) - Add standard training reports (2x) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
119 lines
3.3 KiB
Markdown
119 lines
3.3 KiB
Markdown
# Attention Score Model Training Report
|
|
|
|
**Generated:** 2026-01-25 06:00:49
|
|
|
|
## 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:** XAUUSD
|
|
- **Timeframes:** 5m
|
|
- **Training Data Cutoff:** 2026-01-20
|
|
- **Training Years:** 1.0
|
|
- **Holdout Years:** 0.1
|
|
|
|
### 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 % |
|
|
|-------|--------|-----|---------|--------|---------|--------|---------|-------------|
|
|
| XAUUSD_5m_attention | XAUUSD | 5m | 0.8237 | 0.2248 | 58.35% | 56.10% | 52983 | 40.2% |
|
|
|
|
|
|
## Class Distribution (Holdout Set)
|
|
|
|
| Model | Low Flow | Medium Flow | High Flow |
|
|
|-------|----------|-------------|-----------|
|
|
| XAUUSD_5m_attention | 62 (0.9%) | 3890 (58.8%) | 2661 (40.2%) |
|
|
|
|
|
|
## Feature Importance
|
|
|
|
### XAUUSD_5m_attention
|
|
|
|
| Rank | Feature | Combined Importance |
|
|
|------|---------|--------------------|
|
|
| 1 | ATR_ratio | 0.4268 |
|
|
| 2 | ATR | 0.1115 |
|
|
| 3 | displacement | 0.0801 |
|
|
| 4 | BB_width | 0.0801 |
|
|
| 5 | volume_ratio | 0.0776 |
|
|
| 6 | CMF | 0.0637 |
|
|
| 7 | volume_z | 0.0592 |
|
|
| 8 | MFI | 0.0524 |
|
|
| 9 | OBV_delta | 0.0486 |
|
|
|
|
|
|
|
|
## 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
|
|
|
|
```python
|
|
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*
|