fix: update test assertions for state_dim=65 (42 market + 20 OFI + 3 portfolio)

Tests had hardcoded state_dim=45/53 from before OFI was always enabled.
PPO tests use raw 45-dim data (no OFI), DQN tests use 65-dim.
899 unit tests pass, 20 GPU smoke tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-04-18 01:27:07 +02:00
parent 074ee93da6
commit 5461915a97
2 changed files with 7 additions and 7 deletions

View File

@@ -857,7 +857,7 @@ mod tests {
let gpu_data = DqnGpuData::upload(&data, &stream).expect("upload");
let portfolio = [0.95_f32, 0.5, 0.0001];
let state = gpu_data.build_state_tensor(0, &portfolio, &stream).expect("state");
assert_eq!(state.len(), 45); // 42 market + 3 portfolio
assert_eq!(state.len(), 65); // 42 market + 20 OFI (zeros) + 3 portfolio
}
#[test]
@@ -988,10 +988,10 @@ mod tests {
// Build batch of 32 states starting at bar 10
let batch = gpu_data.build_batch_states(10, 32, &portfolio, &stream).expect("batch");
assert_eq!(batch.len(), 32 * 45); // 42 market + 3 portfolio
assert_eq!(batch.len(), 32 * 65); // 42 market + 20 OFI + 3 portfolio
// Download and verify portfolio features in row 0
let mut host = vec![0.0_f32; 32 * 45];
let mut host = vec![0.0_f32; 32 * 65];
dtoh_f32(&stream, &batch, &mut host).expect("DtoH");
// Row 0: features[42..45] should be portfolio [0.95, 0.5, 0.0001]
@@ -1000,7 +1000,7 @@ mod tests {
assert!((pf[1] - 0.5).abs() < 0.02, "portfolio[1]={}", pf[1]);
// Row 31: same portfolio features
let row31_start = 31 * 45;
let row31_start = 31 * 65;
let pf31 = &host[row31_start + 42..row31_start + 45];
assert!((pf31[0] - 0.95).abs() < 0.02);
@@ -1020,7 +1020,7 @@ mod tests {
// Request more bars than available -> clamped to 2
let batch = gpu_data.build_batch_states(0, 100, &portfolio, &stream).expect("batch");
assert_eq!(batch.len(), 2 * 45);
assert_eq!(batch.len(), 2 * 65);
// Start beyond range -> error
let err = gpu_data.build_batch_states(5, 10, &portfolio, &stream);

View File

@@ -117,9 +117,9 @@ async fn test_feature_vector_to_state() {
let state = state.unwrap();
// State dimension depends on whether OFI (MBP-10) data dirs are configured:
// - Without OFI: 45 = 42 market + 3 portfolio
// - With OFI: 53 = 42 market + 8 OFI + 3 portfolio
// - With OFI: 65 = 42 market + 20 OFI + 3 portfolio
// Smoketest TOML sets mbp10_data_dir, so OFI is enabled.
let expected_dim = if trainer.hyperparams.mbp10_data_dir.is_empty() { 45 } else { 53 };
let expected_dim = if trainer.hyperparams.mbp10_data_dir.is_empty() { 45 } else { 65 };
assert_eq!(
state.dimension(),
expected_dim,