tfma.metrics.MetricComputation
Stay organized with collections
Save and categorize content based on your preferences.
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.
Attributes |
keys
|
List of metric keys associated with computation. If the keys are
defined as part of the computation then this may be empty in which case
only the combiner name will be used for identifying computation
uniqueness.
|
preprocessors
|
Takes a extracts (or a list of extracts) as input (which
typically will contain labels, predictions, example weights, and
optionally features) and should return the initial state that the combiner
will use as input. The output of a processor should only contain
information needed by the combiner.
|
combiner
|
Takes preprocessor output as input and outputs a tuple: (slice,
metric results). The metric results should be a dict from MetricKey to
value (float, int, distribution, ...).
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tfma.metrics.MetricComputation\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/metrics/metric_types.py#L499-L567) |\n\nMetricComputation represents one or more metric computations. \n\n tfma.metrics.MetricComputation(\n keys: List[../../tfma/metrics/MetricKey],\n preprocessors: Optional[List[Preprocessor]],\n combiner: beam.CombineFn\n )\n\nThe preprocessors are called with a PCollection of extracts (or list of\nextracts if query_key is used) to compute the initial combiner input state\nwhich is then passed to the combiner. This needs to be done in two steps\nbecause slicing happens between the call to the preprocessors and the combiner\nand this state may end up in multiple slices so we want the representation to\nbe as efficient as possible. If the preprocessors are None, then\nStandardMetricInputs will be passed.\n\nA MetricComputation is uniquely identified by the combination of the\ncombiner's name and the keys. Duplicate computations will be removed\nautomatically.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `keys` | List of metric keys associated with computation. If the keys are defined as part of the computation then this may be empty in which case only the combiner name will be used for identifying computation uniqueness. |\n| `preprocessors` | Takes a extracts (or a list of extracts) as input (which typically will contain labels, predictions, example weights, and optionally features) and should return the initial state that the combiner will use as input. The output of a processor should only contain information needed by the combiner. |\n| `combiner` | Takes preprocessor output as input and outputs a tuple: (slice, metric results). The metric results should be a dict from MetricKey to value (float, int, distribution, ...). |\n\n\u003cbr /\u003e"]]