Metric wraps a set of metric computations.

This class exists to provide similarity between tfma.metrics.Metric and tf.keras.metics.Metric.

Calling computations creates the metric computations. The parameters passed to init will be combined with the parameters passed to the computations method. This allows some of the parameters (e.g. model_names, output_names, sub_keys) to be set at the time the computations are created instead of when the metric is defined.

create_computations_fn Function to create the metrics computations (e.g. mean_label, etc). This function should take the args passed to init as as input along with any of eval_config, schema, model_names, output_names, sub_keys, aggregation_type, or query_key (where needed).
**kwargs Any additional kwargs to pass to create_computations_fn. These should only contain primitive types or lists/dicts of primitive types. The kwargs passed to computations have precendence over these kwargs.

compute_confidence_interval Whether to compute confidence intervals for this metric.

Note that this may not completely remove the computational overhead involved in computing a given metric. This is only respected by the jackknife confidence interval method.



View source

Creates computations associated with metric.


View source


View source

Returns serializable config.