╔══════════════════════════════════════════════════════════════════════════════╗ ║ CHECKPOINT SELECTION FRAMEWORK ║ ║ (Production-Ready Design) ║ ╚══════════════════════════════════════════════════════════════════════════════╝ ┌─────────────────────────────────────────────────────────────────────────────┐ │ PROBLEM: After 100 epochs of training, how do we select the best │ │ checkpoints for production ensemble trading? │ └─────────────────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────────────────┐ │ SOLUTION: Systematic Scoring Algorithm │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ Score = 0.4 × Sharpe + 0.3 × WinRate + 0.2 × TradePct + 0.1 × Drawdown │ │ │ │ Components (normalized 0-100): │ │ ┌──────────────────────────────────────────────────────────────────────┐ │ │ │ 1. SHARPE RATIO (40% weight) │ │ │ │ Target: >1.0 | Elite: >2.0 │ │ │ │ Scoring: 0→0pts, 1.0→50pts, 2.0→80pts, 3.0→100pts │ │ │ └──────────────────────────────────────────────────────────────────────┘ │ │ ┌──────────────────────────────────────────────────────────────────────┐ │ │ │ 2. WIN RATE (30% weight) │ │ │ │ Target: >50% | Elite: >55% │ │ │ │ Scoring: 50%→50pts, 55%→80pts, 60%→100pts │ │ │ └──────────────────────────────────────────────────────────────────────┘ │ │ ┌──────────────────────────────────────────────────────────────────────┐ │ │ │ 3. TRADE FREQUENCY (20% weight) │ │ │ │ Target: 2-5% of bars | Current baseline: 0.01% ❌ │ │ │ │ Scoring: 0.1%→0pts, 2%→50pts, 3.5%→100pts, >5% penalized │ │ │ └──────────────────────────────────────────────────────────────────────┘ │ │ ┌──────────────────────────────────────────────────────────────────────┐ │ │ │ 4. MAX DRAWDOWN (10% weight, inverted) │ │ │ │ Target: <20% | Elite: <10% │ │ │ │ Scoring: 5%→100pts, 10%→80pts, 20%→40pts, >30%→0pts │ │ │ └──────────────────────────────────────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────────────────┐ │ RANKING PIPELINE │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ Step 1: Checkpoint Discovery (MinIO/S3 scan) │ │ ↓ │ │ Step 2: Load Metadata (CheckpointMetadata × N checkpoints) │ │ ↓ │ │ Step 3: Parallel Backtest (GPU-accelerated, 4 workers) │ │ ├─ DQN epoch 10 → PerformanceAnalytics │ │ ├─ DQN epoch 20 → PerformanceAnalytics │ │ ├─ DQN epoch 30 → PerformanceAnalytics │ │ └─ ... (all checkpoints) │ │ ↓ │ │ Step 4: Statistical Filter (min 30 trades, 30 days) │ │ ↓ │ │ Step 5: Score Calculation (composite 0-100) │ │ ├─ Checkpoint A: 85.4 (ELITE) │ │ ├─ Checkpoint B: 78.2 (GOOD) │ │ ├─ Checkpoint C: 72.1 (ACCEPTABLE) │ │ └─ ... │ │ ↓ │ │ Step 6: Ranking (descending by score) │ │ ↓ │ │ Step 7: Top-K Selection (top 5 DQN + top 5 PPO) │ │ ↓ │ │ Step 8: Ensemble Composition (10-model ensemble) │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────────────────┐ │ ENSEMBLE COMPOSITION │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ DQN Models (Top 5): │ │ ┌────────────────────────────────────────────────────────────────────┐ │ │ │ • dqn_epoch80_score85.4 (weight: 0.22) ─┐ │ │ │ │ • dqn_epoch70_score78.2 (weight: 0.20) │ │ │ │ │ • dqn_epoch90_score75.0 (weight: 0.19) ├─ DQN Signal (0.35 conf) │ │ │ │ • dqn_epoch60_score72.5 (weight: 0.20) │ │ │ │ │ • dqn_epoch50_score70.1 (weight: 0.19) ┘ │ │ │ └────────────────────────────────────────────────────────────────────┘ │ │ │ │ PPO Models (Top 5): │ │ ┌────────────────────────────────────────────────────────────────────┐ │ │ │ • ppo_epoch90_score82.1 (weight: 0.23) ─┐ │ │ │ │ • ppo_epoch80_score76.5 (weight: 0.21) │ │ │ │ │ • ppo_epoch70_score74.2 (weight: 0.19) ├─ PPO Signal (0.32 conf) │ │ │ │ • ppo_epoch100_score71.8 (weight: 0.19) │ │ │ │ │ • ppo_epoch60_score68.9 (weight: 0.18) ┘ │ │ │ └────────────────────────────────────────────────────────────────────┘ │ │ ↓ │ │ ┌────────────────────────┐ │ │ │ Ensemble Aggregation │ │ │ │ (Weighted Average) │ │ │ └────────────────────────┘ │ │ ↓ │ │ Final Trading Signal: BUY (confidence: 0.68) │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────────────────┐ │ PERIODIC RE-EVALUATION │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ Schedule: Weekly (Sunday 00:00 UTC) │ │ │ │ Triggers: │ │ • New training epochs completed ────────────────┐ │ │ • Ensemble Sharpe drops >10% ───────────────────┤ │ │ • Market regime change (volatility spike) ──────├─ Re-rank Checkpoints │ │ • Manual operator command ──────────────────────┘ │ │ │ │ Process: │ │ 1. Re-run checkpoint ranking │ │ 2. Compare top 5 vs. current ensemble │ │ 3. If top 3 changed → Update ensemble │ │ 4. Otherwise → Keep current (stability) │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────────────────┐ │ SCORING EXAMPLES │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ Example 1: ELITE Checkpoint (Score: 92.5) │ │ ┌────────────────────────────────────────────────────────────────────┐ │ │ │ Sharpe: 2.3 → 85 pts × 0.4 = 34.0 │ │ │ │ WinRate: 58% → 92 pts × 0.3 = 27.6 │ │ │ │ TradePct: 3.8% → 95 pts × 0.2 = 19.0 │ │ │ │ Drawdown: 8% → 98 pts × 0.1 = 9.8 │ │ │ │ ───────────────────────────────────── │ │ │ │ TOTAL: 90.4 ✅ DEPLOY TO PRODUCTION │ │ │ └────────────────────────────────────────────────────────────────────┘ │ │ │ │ Example 2: FAILED Checkpoint (Score: 14.75) │ │ ┌────────────────────────────────────────────────────────────────────┐ │ │ │ Sharpe: -0.2 → 0 pts × 0.4 = 0.0 │ │ │ │ WinRate: 45% → 45 pts × 0.3 = 13.5 │ │ │ │ TradePct: 0.05% → 1.25 pts × 0.2 = 0.25 │ │ │ │ Drawdown: 35% → 10 pts × 0.1 = 1.0 │ │ │ │ ───────────────────────────────────── │ │ │ │ TOTAL: 14.75 ❌ REJECT │ │ │ └────────────────────────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────────────────┐ │ IMPLEMENTATION ROADMAP (7 weeks) │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ Week 1-2: Core Scoring Functions │ │ ├─ ml/src/checkpoint/selection.rs (scoring logic) │ │ ├─ normalize_*() functions (4 metrics) │ │ ├─ calculate_checkpoint_score() │ │ └─ Unit tests (100% coverage) │ │ │ │ Week 3: Backtest Integration │ │ ├─ CheckpointSelector struct │ │ ├─ rank_checkpoints() method │ │ ├─ Parallel backtesting (4 workers) │ │ └─ Integration tests with real DBN data │ │ │ │ Week 4: Ensemble Composition │ │ ├─ Update ensemble/model.rs │ │ ├─ deploy_top_checkpoints() method │ │ ├─ Score-based weighting │ │ └─ Health monitoring │ │ │ │ Week 5: TLI Commands │ │ ├─ tli checkpoint rank/select/list │ │ ├─ tli ensemble deploy/health │ │ └─ User documentation │ │ │ │ Week 6-7: Production Deployment │ │ ├─ Weekly cron job (Sunday 00:00 UTC) │ │ ├─ CI/CD integration │ │ ├─ Performance monitoring │ │ └─ Validation with 90-day backtest │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────────────────┐ │ SUCCESS METRICS │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ Immediate (Week 1-4): │ │ ✓ Checkpoint ranking <100ms per checkpoint │ │ ✓ Statistical filter removes <20% false positives │ │ ✓ Score correlation >0.8 with manual ranking │ │ │ │ Short-term (Month 1-2): │ │ ✓ Ensemble Sharpe >1.5 (vs. 1.0 baseline) │ │ ✓ Trade frequency 2-5% (vs. 0.01% baseline) │ │ ✓ Win rate >52% (vs. 50% baseline) │ │ ✓ Max drawdown <15% (vs. 20% baseline) │ │ │ │ Long-term (Month 3-6): │ │ ✓ Ensemble outperforms best model by >20% │ │ ✓ Re-evaluation detects degradation <7 days │ │ ✓ Production uptime >99.5% │ │ ✓ 100% user adoption │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ ┌─────────────────────────────────────────────────────────────────────────────┐ │ NEXT ACTIONS │ ├─────────────────────────────────────────────────────────────────────────────┤ │ │ │ 1. ✅ Review CHECKPOINT_SELECTION_FRAMEWORK.md (full 10K word spec) │ │ 2. ✅ Read CHECKPOINT_SELECTION_QUICKSTART.md (implementation guide) │ │ 3. ⏳ Implement ml/src/checkpoint/selection.rs (Week 1-2) │ │ 4. ⏳ Test with synthetic checkpoints (Week 2) │ │ 5. ⏳ Integrate with backtesting engine (Week 3) │ │ 6. ⏳ Deploy to production (Week 6-7) │ │ │ └─────────────────────────────────────────────────────────────────────────────┘ ════════════════════════════════════════════════════════════════════════════════ Status: DESIGN COMPLETE ✅ | Ready for Implementation | Priority: HIGH ════════════════════════════════════════════════════════════════════════════════