tfma.view.SlicedMetrics

A tuple containing the metrics belonging to a slice.

The metrics are stored in a nested dictionary with the following levels:

  1. output_name: Optional output name associated with metric (for multi-output models). '' by default.
  2. sub_key: Optional sub key associated with metric (for multi-class models). '' by default. See tfma.metrics.SubKey for more info.
  3. metric_name: Name of the metric (auc, accuracy, etc).
  4. metric_value: A dictionary containing the metric's value. See tfma.proto.metrics_for_slice_pb2.MetricValue for more info.

Below is a sample SlicedMetrics:

(
  (('color', 'green')),
  {
    '': {  # default for single-output models
      '': {  # default sub_key for non-multiclass-classification models
        'auc': {
          'doubleValue': 0.7243943810462952
        },
        'accuracy': {
          'doubleValue': 0.6488351225852966
        }
      }
    }
  }
)

slice A 2-element tuple representing a slice. The first element is the key of a feature (ex: 'color'), and the second element is the value (ex: 'green'). An empty tuple represents an 'overall' slice (i.e. one that encompasses the entire dataset.
metrics A nested dictionary containing metric names and values.