nemo_rl.experience.metric_utils#
Shared aggregation helpers for rollout metrics.
Module Contents#
Functions#
Compute summary statistics for a metric as slash-prefixed keys. |
|
Percentile helper for buffer starvation diagnostics. |
API#
- nemo_rl.experience.metric_utils.calculate_single_metric(
- values: collections.abc.Sequence[float | int],
- batch_size: int,
- key_name: str,
Compute summary statistics for a metric as slash-prefixed keys.
- Parameters:
values – Per-sample metric values to aggregate.
batch_size – Denominator for the mean (sum(values) / batch_size, not len(values)); stddev still uses len(values).
key_name – Prefix for the returned metric keys (e.g. “total_reward”).
- Returns:
Dict mapping “{key_name}/{stat}” to its value for stat in mean, max, min, median, stddev (nan for a single value), and histogram (a wandb.Histogram).
- nemo_rl.experience.metric_utils.pct(values: collections.abc.Sequence[float | int], p: float) float#
Percentile helper for buffer starvation diagnostics.