View source on GitHub |
MetricComputation represents one or more metric computations.
tfma.metrics.MetricComputation(
keys: List[tfma.metrics.MetricKey
],
preprocessors: Optional[List[Preprocessor]],
combiner: beam.CombineFn
)
The preprocessors are called with a PCollection of extracts (or list of extracts if query_key is used) to compute the initial combiner input state which is then passed to the combiner. This needs to be done in two steps because slicing happens between the call to the preprocessors and the combiner and this state may end up in multiple slices so we want the representation to be as efficient as possible. If the preprocessors are None, then StandardMetricInputs will be passed.
A MetricComputation is uniquely identified by the combination of the combiner's name and the keys. Duplicate computations will be removed automatically.