# Module: tf.contrib.metrics

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/metrics/__init__.py) |

Ops for evaluation metrics and summary statistics.

See the
[Contrib Metrics](https://tensorflow.org/api_guides/python/contrib.metrics)
guide.

## Functions

[`accuracy(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/accuracy): Computes the percentage of times that predictions matches labels.

[`aggregate_metric_map(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/aggregate_metric_map): Aggregates the metric names to tuple dictionary.

[`aggregate_metrics(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/aggregate_metrics): Aggregates the metric value tensors and update ops into two lists.

[`auc_using_histogram(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/auc_using_histogram): AUC computed by maintaining histograms.

[`auc_with_confidence_intervals(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/auc_with_confidence_intervals): Computes the AUC and asymptotic normally distributed confidence interval.

[`cohen_kappa(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/cohen_kappa): Calculates Cohen's kappa.

[`confusion_matrix(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/confusion_matrix): Deprecated. Use tf.math.confusion_matrix instead.

[`count(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/count): Computes the number of examples, or sum of `weights`.

[`f1_score(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/f1_score): Computes the approximately best F1-score across different thresholds.

[`precision_at_recall(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/precision_at_recall): Computes the precision at a given recall.

[`precision_recall_at_equal_thresholds(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/precision_recall_at_equal_thresholds): A helper method for creating metrics related to precision-recall curves.

[`recall_at_precision(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/recall_at_precision): Computes `recall` at `precision`.

[`set_difference(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/sets/difference): Compute set difference of elements in last dimension of `a` and `b`.

[`set_intersection(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/sets/intersection): Compute set intersection of elements in last dimension of `a` and `b`.

[`set_size(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/sets/size): Compute number of unique elements along last dimension of `a`.

[`set_union(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/sets/union): Compute set union of elements in last dimension of `a` and `b`.

[`sparse_recall_at_top_k(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/sparse_recall_at_top_k): Computes recall@k of top-k predictions with respect to sparse labels.

[`streaming_accuracy(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_accuracy): Calculates how often `predictions` matches `labels`. (deprecated)

[`streaming_auc(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_auc): Computes the approximate AUC via a Riemann sum. (deprecated)

[`streaming_concat(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_concat): Concatenate values along an axis across batches.

[`streaming_covariance(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_covariance): Computes the unbiased sample covariance between `predictions` and `labels`.

[`streaming_curve_points(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_curve_points): Computes curve (ROC or PR) values for a prespecified number of points.

[`streaming_dynamic_auc(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_dynamic_auc): Computes the apporixmate AUC by a Riemann sum with data-derived thresholds.

[`streaming_false_negative_rate(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_false_negative_rate): Computes the false negative rate of predictions with respect to labels.

[`streaming_false_negative_rate_at_thresholds(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_false_negative_rate_at_thresholds): Computes various fnr values for different `thresholds` on `predictions`.

[`streaming_false_negatives(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_false_negatives): Computes the total number of false negatives. (deprecated)

[`streaming_false_negatives_at_thresholds(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_false_negatives_at_thresholds)

[`streaming_false_positive_rate(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_false_positive_rate): Computes the false positive rate of predictions with respect to labels.

[`streaming_false_positive_rate_at_thresholds(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_false_positive_rate_at_thresholds): Computes various fpr values for different `thresholds` on `predictions`.

[`streaming_false_positives(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_false_positives): Sum the weights of false positives. (deprecated)

[`streaming_false_positives_at_thresholds(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_false_positives_at_thresholds)

[`streaming_mean(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_mean): Computes the (weighted) mean of the given values. (deprecated)

[`streaming_mean_absolute_error(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_mean_absolute_error): Computes the mean absolute error between the labels and predictions. (deprecated)

[`streaming_mean_cosine_distance(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_mean_cosine_distance): Computes the cosine distance between the labels and predictions.

[`streaming_mean_iou(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_mean_iou): Calculate per-step mean Intersection-Over-Union (mIOU).

[`streaming_mean_relative_error(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_mean_relative_error): Computes the mean relative error by normalizing with the given values.

[`streaming_mean_squared_error(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_mean_squared_error): Computes the mean squared error between the labels and predictions. (deprecated)

[`streaming_mean_tensor(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_mean_tensor): Computes the element-wise (weighted) mean of the given tensors. (deprecated)

[`streaming_pearson_correlation(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_pearson_correlation): Computes Pearson correlation coefficient between `predictions`, `labels`.

[`streaming_percentage_less(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_percentage_less): Computes the percentage of values less than the given threshold.

[`streaming_precision(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_precision): Computes the precision of the predictions with respect to the labels. (deprecated)

[`streaming_precision_at_thresholds(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_precision_at_thresholds): Computes precision values for different `thresholds` on `predictions`. (deprecated)

[`streaming_recall(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_recall): Computes the recall of the predictions with respect to the labels. (deprecated)

[`streaming_recall_at_k(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_recall_at_k): Computes the recall@k of the predictions with respect to dense labels. (deprecated)

[`streaming_recall_at_thresholds(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_recall_at_thresholds): Computes various recall values for different `thresholds` on `predictions`. (deprecated)

[`streaming_root_mean_squared_error(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_root_mean_squared_error): Computes the root mean squared error between the labels and predictions. (deprecated)

[`streaming_sensitivity_at_specificity(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_sensitivity_at_specificity): Computes the sensitivity at a given specificity.

[`streaming_sparse_average_precision_at_k(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_sparse_average_precision_at_k): Computes average precision@k of predictions with respect to sparse labels.

[`streaming_sparse_average_precision_at_top_k(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_sparse_average_precision_at_top_k): Computes average precision@k of predictions with respect to sparse labels.

[`streaming_sparse_precision_at_k(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_sparse_precision_at_k): Computes precision@k of the predictions with respect to sparse labels.

[`streaming_sparse_precision_at_top_k(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_sparse_precision_at_top_k): Computes precision@k of top-k predictions with respect to sparse labels.

[`streaming_sparse_recall_at_k(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_sparse_recall_at_k): Computes recall@k of the predictions with respect to sparse labels.

[`streaming_specificity_at_sensitivity(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_specificity_at_sensitivity): Computes the specificity at a given sensitivity.

[`streaming_true_negatives(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_true_negatives): Sum the weights of true_negatives. (deprecated)

[`streaming_true_negatives_at_thresholds(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_true_negatives_at_thresholds)

[`streaming_true_positives(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_true_positives): Sum the weights of true_positives. (deprecated)

[`streaming_true_positives_at_thresholds(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/metrics/streaming_true_positives_at_thresholds)