feat: log full validation backtest metrics — Sharpe + Sortino + WinRate + MaxDD + Trades + Calmar

compute_validation_loss only returned Sharpe, discarding all other
backtest metrics. Now logs the complete picture on every epoch so we
can verify if the learning system actually works on out-of-sample data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-04-17 20:48:35 +02:00
parent 30e94446cd
commit 2aa955f0dd

View File

@@ -554,10 +554,16 @@ impl DQNTrainer {
)
}.map_err(|e| anyhow::anyhow!("GPU backtest evaluate_dqn_graphed: {e}"))?;
// Single window — take its Sharpe directly
let val_sharpe = metrics.first()
.map(|m| m.sharpe as f64)
.unwrap_or(0.0);
// Single window — log full validation metrics
let val_sharpe = if let Some(m) = metrics.first() {
tracing::info!(
"Validation backtest: Sharpe={:.2} Sortino={:.2} WinRate={:.1}% MaxDD={:.3}% Trades={:.0} Calmar={:.2}",
m.sharpe, m.sortino, m.win_rate * 100.0, m.max_drawdown * 100.0, m.total_trades, m.calmar,
);
m.sharpe as f64
} else {
0.0
};
Ok(-val_sharpe)
}