# Module: tfma.metrics

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/metrics/__init__.py) |

Init module for TensorFlow Model Analysis metrics.

## Classes

[`class AUC`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/AUC): Approximates the AUC (Area under the curve) of the ROC or PR curves.

[`class AUCCurve`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/AUCCurve): An enumeration.

[`class AUCPrecisionRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/AUCPrecisionRecall): Alias for AUC(curve='PR').

[`class AUCSummationMethod`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/AUCSummationMethod): An enumeration.

[`class AttributionsMetric`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/AttributionsMetric): Base type for attribution metrics.

[`class BalancedAccuracy`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/BalancedAccuracy): Balanced accuracy (BA).

[`class BinaryAccuracy`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/BinaryAccuracy): Calculates how often predictions match binary labels.

[`class BinaryCrossEntropy`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/BinaryCrossEntropy): Calculates the binary cross entropy.

[`class BooleanFlipRates`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/BooleanFlipRates): FlipRate is the rate at which predictions between models switch.

[`class COCOAveragePrecision`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/COCOAveragePrecision): Confusion matrix at thresholds.

[`class COCOAverageRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/COCOAverageRecall): Average recall metric for object detection.

[`class COCOMeanAveragePrecision`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/COCOMeanAveragePrecision): Mean average precision for object detections.

[`class COCOMeanAverageRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/COCOMeanAverageRecall): Mean Average recall metric for object detection.

[`class Calibration`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Calibration): Calibration.

[`class CalibrationPlot`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/CalibrationPlot): Calibration plot.

[`class CategoricalCrossEntropy`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/CategoricalCrossEntropy): Calculates the categorical cross entropy.

[`class CoefficientOfDiscrimination`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/CoefficientOfDiscrimination): Coefficient of discrimination metric.

[`class ConfusionMatrixAtThresholds`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ConfusionMatrixAtThresholds): Confusion matrix at thresholds.

[`class ConfusionMatrixPlot`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ConfusionMatrixPlot): Confusion matrix plot.

[`class DerivedMetricComputation`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/DerivedMetricComputation): DerivedMetricComputation derives its result from other computations.

[`class DiagnosticOddsRatio`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/DiagnosticOddsRatio): Diagnostic odds ratio (DOR).

[`class ExactMatch`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ExactMatch): Exact Match Metric.

[`class ExampleCount`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ExampleCount): Example count.

[`class F1Score`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/F1Score): F1 score.

[`class FN`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FN): Alias for FalseNegatives.

[`class FNR`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FNR): Alias for MissRate.

[`class FP`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FP): Alias for FalsePositives.

[`class FPR`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FPR): Alias for FallOut.

[`class FallOut`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FallOut): Fall-out (FPR).

[`class FalseDiscoveryRate`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FalseDiscoveryRate): False discovery rate (FDR).

[`class FalseNegatives`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FalseNegatives): Calculates the number of false negatives.

[`class FalseOmissionRate`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FalseOmissionRate): False omission rate (FOR).

[`class FalsePositives`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FalsePositives): Calculates the number of false positives.

[`class FowlkesMallowsIndex`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FowlkesMallowsIndex): Fowlkes-Mallows index (FM).

[`class Informedness`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Informedness): Informedness or bookmaker informedness (BM).

[`class Markedness`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Markedness): Markedness (MK) or deltaP.

[`class MatthewsCorrelationCoefficient`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MatthewsCorrelationCoefficient): Matthews corrrelation coefficient (MCC).

[`class MaxRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MaxRecall): Computes the max recall of the predictions with respect to the labels.

[`class Mean`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Mean): Mean metric.

[`class MeanAbsoluteAttributions`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MeanAbsoluteAttributions): Mean aboslute attributions metric.

[`class MeanAbsoluteError`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MeanAbsoluteError): Calculates the mean of absolute error between labels and predictions.

[`class MeanAbsolutePercentageError`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MeanAbsolutePercentageError): Calculates the mean of absolute percentage error.

[`class MeanAttributions`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MeanAttributions): Mean attributions metric.

[`class MeanLabel`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MeanLabel): Mean label.

[`class MeanPrediction`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MeanPrediction): Mean prediction.

[`class MeanSquaredError`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MeanSquaredError): Calculates the mean of squared error between labels and predictions.

[`class MeanSquaredLogarithmicError`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MeanSquaredLogarithmicError): Calculates the mean of squared logarithmic error.

[`class Metric`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Metric): Metric wraps a set of metric computations.

[`class MetricComputation`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MetricComputation): MetricComputation represents one or more metric computations.

[`class MetricKey`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MetricKey): A MetricKey uniquely identifies a metric.

[`class MinLabelPosition`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MinLabelPosition): Min label position metric.

[`class MissRate`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MissRate): Miss rate (FNR).

[`class MultiClassConfusionMatrixAtThresholds`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MultiClassConfusionMatrixAtThresholds): Multi-class confusion matrix metrics at thresholds.

[`class MultiClassConfusionMatrixPlot`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MultiClassConfusionMatrixPlot): Multi-class confusion matrix plot.

[`class MultiLabelConfusionMatrixPlot`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MultiLabelConfusionMatrixPlot): Multi-label confusion matrix.

[`class NDCG`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/NDCG): NDCG (normalized discounted cumulative gain) metric.

[`class NPV`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/NPV): Alias for NegativePredictiveValue.

[`class NegativeLikelihoodRatio`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/NegativeLikelihoodRatio): Negative likelihood ratio (LR-).

[`class NegativePredictiveValue`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/NegativePredictiveValue): Negative predictive value (NPV).

[`class ObjectDetectionConfusionMatrixPlot`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ObjectDetectionConfusionMatrixPlot): Object Detection Confusion matrix plot.

[`class ObjectDetectionMaxRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ObjectDetectionMaxRecall): Computes the max recall of the predictions with respect to the labels.

[`class ObjectDetectionPrecision`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ObjectDetectionPrecision): Computes the precision of the predictions with respect to the labels.

[`class ObjectDetectionPrecisionAtRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ObjectDetectionPrecisionAtRecall): Computes best precision where recall is \>= specified value.

[`class ObjectDetectionRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ObjectDetectionRecall): Computes the recall of the predictions with respect to the labels.

[`class ObjectDetectionThresholdAtRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ObjectDetectionThresholdAtRecall): Computes maximum threshold where recall is \>= specified value.

[`class PPV`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/PPV): Alias for Precision.

[`class PlotKey`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/PlotKey): A PlotKey is a metric key that uniquely identifies a plot.

[`class PositiveLikelihoodRatio`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/PositiveLikelihoodRatio): Positive likelihood ratio (LR+).

[`class Precision`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Precision): Computes the precision of the predictions with respect to the labels.

[`class PrecisionAtRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/PrecisionAtRecall): Computes best precision where recall is \>= specified value.

[`class Preprocessor`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Preprocessor): Preprocessor wrapper for preprocessing data in the metric computation.

[`class Prevalence`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Prevalence): Prevalence.

[`class PrevalenceThreshold`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/PrevalenceThreshold): Prevalence threshold (PT).

[`class QueryStatistics`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/QueryStatistics): Query statistic metrics.

[`class Recall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Recall): Computes the recall of the predictions with respect to the labels.

[`class RecallAtPrecision`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/RecallAtPrecision): Computes best recall where precision is \>= specified value.

[`class RelativeCoefficientOfDiscrimination`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/RelativeCoefficientOfDiscrimination): Relative coefficient of discrimination metric.

[`class ScoreDistributionPlot`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ScoreDistributionPlot): Score distribution plot.

[`class SemanticSegmentationConfusionMatrix`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SemanticSegmentationConfusionMatrix): Computes confusion matrices for semantic segmentation.

[`class SemanticSegmentationFalsePositive`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SemanticSegmentationFalsePositive): Calculates the true postive for semantic segmentation.

[`class SemanticSegmentationTruePositive`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SemanticSegmentationTruePositive): Calculates the true postive for semantic segmentation.

[`class SensitivityAtSpecificity`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SensitivityAtSpecificity): Computes best sensitivity where specificity is \>= specified value.

[`class SetMatchPrecision`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SetMatchPrecision): Computes precision for sets of labels and predictions.

[`class SetMatchRecall`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SetMatchRecall): Computes recall for sets of labels and predictions.

[`class Specificity`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Specificity): Specificity (TNR) or selectivity.

[`class SpecificityAtSensitivity`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SpecificityAtSensitivity): Computes best specificity where sensitivity is \>= specified value.

[`class SquaredPearsonCorrelation`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SquaredPearsonCorrelation): Squared pearson correlation (r\^2) metric.

[`class StandardMetricInputs`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/StandardMetricInputs): Standard inputs used by most metric computations.

[`class SubKey`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SubKey): A SubKey identifies a sub-types of metrics and plots.

[`class SymmetricPredictionDifference`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/SymmetricPredictionDifference): PredictionDifference computes the avg pointwise diff between models.

[`class TN`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/TN): Alias for TrueNegatives.

[`class TNR`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/TNR): Alias for Specificity.

[`class TP`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/TP): Alias for TruePositives.

[`class TPR`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/TPR): Alias for Recall.

[`class ThreatScore`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/ThreatScore): Threat score or critical success index (TS or CSI).

[`class TotalAbsoluteAttributions`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/TotalAbsoluteAttributions): Total absolute attributions metric.

[`class TotalAttributions`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/TotalAttributions): Total attributions metric.

[`class TrueNegatives`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/TrueNegatives): Calculates the number of true negatives.

[`class TruePositives`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/TruePositives): Calculates the number of true positives.

[`class WeightedExampleCount`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/WeightedExampleCount): Weighted example count (deprecated - use ExampleCount).

## Functions

[`CombinedFeaturePreprocessor(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/CombinedFeaturePreprocessor): Returns preprocessor for incl combined features in StandardMetricInputs.

[`FeaturePreprocessor(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/FeaturePreprocessor): Returns preprocessor for including features in StandardMetricInputs.

[`default_binary_classification_specs(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/default_binary_classification_specs): Returns default metric specs for binary classification problems.

[`default_multi_class_classification_specs(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/default_multi_class_classification_specs): Returns default metric specs for multi-class classification problems.

[`default_regression_specs(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/default_regression_specs): Returns default metric specs for for regression problems.

[`has_attributions_metrics(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/has_attributions_metrics): Returns true if any of the metrics_specs have attributions metrics.

[`merge_per_key_computations(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/merge_per_key_computations): Wraps create_computations_fn to be called separately for each key.

[`metric_thresholds_from_metrics_specs(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/metric_thresholds_from_metrics_specs): Returns thresholds associated with given metrics specs.

[`specs_from_metrics(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/specs_from_metrics): Returns specs for tf_keras.metrics/losses or tfma.metrics classes.

[`to_label_prediction_example_weight(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/to_label_prediction_example_weight): Yields label, prediction, and example weights for use in calculations.

[`to_standard_metric_inputs(...)`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/to_standard_metric_inputs): Verifies extract keys and converts extracts to StandardMetricInputs.

## Type Aliases

[`MetricComputations`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MetricComputations)

[`MetricsDict`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MetricsDict)

<br />

<br />

<br />

| ## Other Members ||
|---|---|
| NO_PREDICTED_CLASS_ID | `-1` |

<br />