Repository navigation
Conversation
Add GlobalMeanDriftAggregator, which streams per-sample least-squares slopes (per year) of the area-weighted global-mean bias of each variable over an inference rollout. It logs the sample-mean slope, its t-statistic across samples and the max |t| over variables, and saves the per-sample slopes as a (sample, variable) array in the diagnostics. Register it on InferenceEvaluatorAggregatorConfig as global_mean_drift (enabled by default, skipped for rollouts of ~2 years or less like the annual metric) and expose the per-sample slopes via InferenceEvaluatorAggregator.get_global_mean_drift_slopes().
Track the recorded step count as a scalar and check the minimum duration as n_time * timestep, replacing the packed per-sample [n, sum_t, sum_tt, t_min, t_max] tensor and its index constants. Trim docstrings.
Drop the zero-drift test (covered by per-sample slope recovery) and merge the two accessor-returns-None tests into one parametrized test.
1 of 2 tasks
yyexela
added a commit
that referenced
this pull request
Nov 3, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a default-on inference metric that measures slow drift of the global-mean bias away from the target, one slope per sample (initial condition or ensemble member) per variable. The per-sample slopes are exposed via
InferenceEvaluatorAggregator.get_global_mean_drift_slopes()so a downstream trainer can test whether the drift is significant using the spread across initial conditions. That accessor has no in-repo caller yet; it is a hook for a downstream trainer.The aggregator accumulates running OLS sums (
n,Σt,Σt²,Σy,Σty) in O(n_samples × n_vars) memory and tracks the recorded step count as a scalar (identical on every rank). Slopes are NaN whenn_time * timestep < 730 days, matching the annual-metric minimum. Samples are gathered across data-parallel ranks at finalize time.Logs (under the metric name
global_mean_drift):global_mean_drift/slope/{v}: sample-mean slope (units of v per year)global_mean_drift/t/{v}: mean / (std(ddof=1) / sqrt(n_samples)); NaN when n_samples < 2global_mean_drift/max_abs_t: max over variables of |t|, ignoring NaNglobal_mean_drift_diagnostics.ncholdsslope(sample, variable)andslope_units(variable).The metric is added only to
InferenceEvaluatorAggregatorConfig— it is not added toLegacyFlagInferenceEvaluatorAggregatorConfigor the coupledInferenceEvaluatorAggregatorConfig(fme/coupled/aggregator.py).Changes:
fme.ace.aggregator.inference.global_mean_drift: newGlobalMeanDriftAggregatorandGlobalMeanDriftConfig(default-on, skipped for rollouts ≤ 730 days).GlobalMeanDriftConfigis exported fromfme.ace.fme.ace.aggregator.inference.data: newPerSampleSlopesprotocol andMetricBuildResult.per_sample_slopesslot, so the build loop hands the aggregator to the top level without isinstance checks.fme.ace.aggregator.inference.main: registers the config in theMetricConfigunion, addsglobal_mean_driftfield toInferenceEvaluatorAggregatorConfig, and addsInferenceEvaluatorAggregator.get_global_mean_drift_slopes().fme.core.testing.MockDistributed: addsdata_parallel_gather.Tests added
If dependencies changed, "deps only" image rebuilt and "latest_deps_only_image.txt" file updated (no dependency changes)