malkhut(optim): vectorized reward + Ray parallel eval + VBT post-analysis
1. Vectorized reward path (cwm/core.py): - Wired up existing compute_reward_vectorized from numba_core (was unused!) - Eliminates FeatureVector dict allocation + Python dict lookups on hot path - Numba path used when _HAS_NUMBA=True, Python fallback otherwise - Bit-identical: same math operations, just via numba JIT 2. Ray-based parallel eval (training/ray_eval.py): - Industrial multi-core execution via Ray (used by OpenAI/Anyscale) - ray.put() stores params/scenarios in shared object store (no pickle per worker) - Each worker: own CWM + planner, zero shared state, no races - Bit-identical: same seed + same params = same results regardless of worker count - PolicyEvaluator.evaluate_candidate: new use_ray=True parameter 3. VBT post-analysis (training/vbt_analysis.py): - episodes_to_pnl_array, episodes_to_metrics (Sharpe, Sortino, VaR, win_rate, etc.) - cross_asset_comparison, parameter_sensitivity - format_metrics for human-readable output - Analysis tool only — runs AFTER engine produces results 4. numba_core.py: added missing 'import math' for compute_reward_vectorized 13 new tests: vectorized reward bit-identity, Ray determinism, Ray result fields, VBT metrics structure, cross-asset comparison, parameter sensitivity, edge cases. Total: 1178 tests, 50 files, all green, zero regressions.
This commit is contained in:
@@ -12,6 +12,7 @@ not dataclasses. The CWM calls these from its hot path.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import math
|
||||
import numpy as np
|
||||
from numba import njit, prange
|
||||
|
||||
|
||||
Reference in New Issue
Block a user