Shortcuts

SubgroupMetric#

class ignite.metrics.fairness.SubgroupMetric(base_metric, groups, output_transform=<function _SubgroupBase.<lambda>>, device=device(type='cpu'))[source]#

A wrapper metric that computes a base metric for each unique subgroup in the dataset.

This class handles slicing the input data (y_pred, y) according to group labels and maintains independent state for each group by delegating to a dictionary of metrics.

Parameters:
  • base_metric (Metric) – an instance of the metric to be computed for each group. This metric will be cloned for each group.

  • groups (Sequence[Any]) – a sequence of unique group identifiers.

  • output_transform (Callable) – a callable that is used to transform the Engine’s process_function’s output into the form expected by the metric. Default is (y_pred, y, group_labels).

  • device (str | device) – specifies which device updates are accumulated on.

New in version 0.5.4.

Methods

compute

Computes the metric for each subgroup.

compute()[source]#

Computes the metric for each subgroup.

Returns:

A dictionary mapping group identifiers to their respective metric results.

Return type:

dict[Any, Any]

×

Search Docs