feat(ml): wire PPO accumulation_steps from hyperparams to PPOConfig
Exposes gradient_accumulation_steps in PpoHyperparameters so hyperopt and training binaries can configure effective batch scaling. The actual accumulation logic already existed in PPO::update_mlp(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -73,6 +73,9 @@ pub struct PpoHyperparameters {
|
||||
pub initial_capital: f64,
|
||||
/// Average bid-ask spread for GPU portfolio simulation (default: 0.0001 = 1bp)
|
||||
pub avg_spread: f64,
|
||||
/// Number of gradient accumulation steps (default: 1 = no accumulation).
|
||||
/// effective_batch = mini_batch_size * accumulation_steps
|
||||
pub accumulation_steps: usize,
|
||||
}
|
||||
|
||||
// REMOVED: Default implementation for PpoHyperparameters
|
||||
@@ -123,6 +126,7 @@ impl PpoHyperparameters {
|
||||
gpu_timesteps_per_episode: 500, // Default: 500 timesteps per episode
|
||||
initial_capital: 1_000_000.0, // Default: $1M
|
||||
avg_spread: 0.0001, // Default: 1bp (ES/NQ futures)
|
||||
accumulation_steps: 1, // Default: no accumulation
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,7 +168,7 @@ impl From<PpoHyperparameters> for PPOConfig {
|
||||
lstm_hidden_dim: 128,
|
||||
lstm_num_layers: 1,
|
||||
lstm_sequence_length: 32,
|
||||
accumulation_steps: 1,
|
||||
accumulation_steps: params.accumulation_steps.max(1),
|
||||
clip_epsilon_high: None,
|
||||
mixed_precision: None, // Auto-detected at trainer initialization
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ fn create_test_hyperparams(_use_lstm: bool, sequence_length: usize) -> PpoHyperp
|
||||
gpu_timesteps_per_episode: 500,
|
||||
initial_capital: 1_000_000.0,
|
||||
avg_spread: 0.0001,
|
||||
accumulation_steps: 1,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user