tfma.metrics.DerivedMetricComputation

DerivedMetricComputation derives its result from other computations.

When creating derived metric computations it is recommended (but not required) that the underlying MetricComputations that they depend on are defined at the same time. This is to avoid having to pre-construct and pass around all the required dependencies in order to construct a derived metric. The evaluation pipeline is responsible for de-duplicating overlapping MetricComputations so that only one computation is actually run.

A DerivedMetricComputation is uniquely identified by the combination of the result function's name and the keys. Duplicate computations will be removed automatically.

keys List of metric keys associated with derived computation. If the keys are defined as part of the computation then this may be empty in which case only the result function name will be used for identifying computation uniqueness.
result Function (called per slice) to compute the result using the results of other metric computations.