tlc.client.torch.metrics.metrics_aggregators.mean_aggregator#

An aggregator that computes the mean of a column.

Module Contents#

Classes#

Class

Description

MeanAggregator

An aggregator that computes the mean any computable sub-value contained in a column in a metric batch.

API#

class tlc.client.torch.metrics.metrics_aggregators.mean_aggregator.MeanAggregator#

Bases: tlc.client.torch.metrics.metrics_aggregators.aggregator.Aggregator

An aggregator that computes the mean any computable sub-value contained in a column in a metric batch.

SUFFIX = avg#
SEPARATOR = __#
compute_batch_aggregate(computed_metrics: dict[str, list[Any]]) dict[str, Any]#

Computes aggregate metrics for a single batch.

This overridden method computes mean metrics for each column and collects them into a dictionary. For nested or composite columns, the mean is computed recursively by traversing each sub-column.

Parameters:

computed_metrics – A dictionary where the keys are column names and the values are lists of metrics.

Returns:

A dictionary containing the mean value(s) for each computable column.

aggregate_across_batches() dict[str, Any]#

Aggregates mean metrics across all batches.

After all batches have been processed, this method calculates the global mean for each column by averaging the batch-wise means.

Returns:

A dictionary containing the global mean value(s) for each computable column.