You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Per-grid state statistics cause normalization and evaluation errors #924
Following up on the state statistics issue raised by @nikhil3495 during the review of #917.
BaseDatastore.get_standardization_dataarray() allows statistics to include a grid_index dimension. However, several consumers of state statistics assume either per-feature statistics or a particular dimension order.
I reproduced the following problems on upstream main (b3ed722):
Batch normalization: Statistics in (state_feature, grid_index) order cause a shape mismatch in on_after_batch_transfer(). When the number of grid points equals the number of state features, normalization can silently return incorrect values instead.
Output clamping:StepPredictor.prepare_clamping_params() fails when normalized clamping limits contain per-grid values.
Difference statistics: Feature-first per-grid difference statistics cause a shape mismatch in get_per_var_std().
Plotting: Prediction and target denormalization fails with feature-first statistics.
Metrics: Physical metric rescaling applies per-grid standard deviations after spatial reduction, which can cause shape mismatches or incorrect RMSE values.
MDP standardization:get_dataarray(..., standardize=True) fails when the stored grid index conflicts with the spatial MultiIndex.
For example, with four grid points and four state features, the normalization test produces incorrect values at 12 of 16 entries without raising an exception.
In a separate metric reproduction, the expected physical RMSE is approximately 3.292416, but the reported value is 2.0.
I prepared local regression tests using both dimension orders, per-feature controls, independent NumPy expectations, and a synthetic MDP datastore. On unchanged upstream code, these produce 10 expected failures and 9 passing controls.
It would be useful to make state statistics handling dimension-aware while preserving existing per-feature behavior. Given the different affected paths, this could be addressed through focused PRs rather than a single large change.
Activity