dataeval.core.combine_stats_results

dataeval.core.combine_stats_results(results)

Combine one or more StatsResults into unified stats, source_index, and dataset_steps.

For a single StatsResult, returns its stats and source_index directly with empty dataset_steps.

For multiple results, concatenates stats arrays by key, applies cumulative item offsets to source_index entries (making item indices globally unique across datasets), and computes cumulative dataset_steps boundaries.

Parameters:
results : StatsResult or Sequence[StatsResult]

A single result or sequence of results to combine.

Returns:

  • stats: Combined statistics mapping (arrays concatenated by key).

  • source_index: Combined source indices with globally unique item values.

  • dataset_steps: Cumulative boundaries where each dataset ends in the combined arrays. Empty list for a single result.

Return type:

tuple[StatsMap, list[SourceIndex], list[int]]

Raises:

TypeError – If an empty sequence is provided.