Home | History | Annotate | Download | only in ops

Lines Matching refs:labels

88 def _remove_squeezable_dimensions(predictions, labels, weights):
91 Squeezes last dim of `predictions` or `labels` if their rank differs by 1
103 labels: Optional label `Tensor` whose dimensions match `predictions`.
108 Tuple of `predictions`, `labels` and `weights`. Each of them possibly has
112 if labels is not None:
113 labels, predictions = confusion_matrix.remove_squeezable_dimensions(
114 labels, predictions)
115 predictions.get_shape().assert_is_compatible_with(labels.get_shape())
118 return predictions, labels, None
124 return predictions, labels, weights
161 return predictions, labels, weights
164 def _maybe_expand_labels(labels, predictions):
165 """If necessary, expand `labels` along last dimension to match `predictions`.
168 labels: `Tensor` or `SparseTensor` with shape
170 num_labels=1, in which case the result is an expanded `labels` with shape
175 `labels` with the same rank as `predictions`.
178 ValueError: if `labels` has invalid shape.
180 with ops.name_scope(None, 'expand_labels', (labels, predictions)) as scope:
181 labels = sparse_tensor.convert_to_tensor_or_sparse_tensor(labels)
184 if isinstance(labels, sparse_tensor.SparseTensor):
188 array_ops.size(labels.dense_shape) + 1),
190 labels,
191 shape=array_ops.concat((labels.dense_shape, (1,)), 0),
193 lambda: labels)
196 labels_rank = labels.get_shape().ndims
201 return labels
203 return array_ops.expand_dims(labels, -1, name=scope)
205 'Unexpected labels shape %s for predictions shape %s.' %
206 (labels.get_shape(), predictions.get_shape()))
211 array_ops.rank(labels) + 1),
212 lambda: array_ops.expand_dims(labels, -1, name=scope), lambda: labels)
231 def _streaming_confusion_matrix(labels, predictions, num_classes, weights=None):
238 labels: A `Tensor` of ground truth labels with shape [batch size] and of
240 predictions: A `Tensor` of prediction results for semantic labels, whose
243 num_classes: The possible number of labels the prediction task can
247 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
248 be either `1`, or the same as the corresponding `labels` dimension).
260 labels = math_ops.cast(labels, dtypes.int64)
267 if labels.get_shape().ndims > 1:
268 labels = array_ops.reshape(labels, [-1])
275 labels, predictions, num_classes, weights=weights, dtype=dtypes.float64)
372 predictions=values, labels=None, weights=weights)
397 def accuracy(labels,
403 """Calculates how often `predictions` matches `labels`.
407 matches `labels`. This frequency is ultimately returned as `accuracy`: an
413 where the corresponding elements of `predictions` and `labels` match and 0.0
421 labels: The ground truth values, a `Tensor` whose shape matches
425 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
426 be either `1`, or the same as the corresponding `labels` dimension).
440 ValueError: If `predictions` and `labels` have mismatched shapes, or if
450 predictions, labels, weights = _remove_squeezable_dimensions(
451 predictions=predictions, labels=labels, weights=weights)
452 predictions.get_shape().assert_is_compatible_with(labels.get_shape())
453 if labels.dtype != predictions.dtype:
454 predictions = math_ops.cast(predictions, labels.dtype)
456 math_ops.equal(predictions, labels), dtypes.float32)
461 def _confusion_matrix_at_thresholds(labels,
471 above `thresholds[i]` whose corresponding entry in `labels` is `True`.
473 at most `thresholds[i]` whose corresponding entry in `labels` is `True`.
475 at most `thresholds[i]` whose corresponding entry in `labels` is `False`.
477 above `thresholds[i]` whose corresponding entry in `labels` is `False`.
486 labels: A `Tensor` whose shape matches `predictions`. Will be cast to
492 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
493 be either `1`, or the same as the corresponding `labels` dimension).
504 ValueError: If `predictions` and `labels` have mismatched shapes, or if
526 predictions, labels, weights = _remove_squeezable_dimensions(
528 labels=math_ops.cast(labels, dtype=dtypes.bool),
533 # Reshape predictions and labels.
536 math_ops.cast(labels, dtype=dtypes.bool), [1, -1])
555 # Tile labels by number of thresholds
630 def auc(labels,
668 labels: A `Tensor` whose shape matches `predictions`. Will be cast to
673 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
674 be either `1`, or the same as the corresponding `labels` dimension).
702 ValueError: If `predictions` and `labels` have mismatched shapes, or if
713 (labels, predictions, weights)):
723 labels, predictions, thresholds, weights)
835 def mean_absolute_error(labels,
841 """Computes the mean absolute error between the labels and predictions.
852 absolute value of the differences between `predictions` and `labels`. Then
860 labels: A `Tensor` of the same shape as `predictions`.
863 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
864 be either `1`, or the same as the corresponding `labels` dimension).
878 ValueError: If `predictions` and `labels` have mismatched shapes, or if
888 predictions, labels, weights = _remove_squeezable_dimensions(
889 predictions=predictions, labels=labels, weights=weights)
890 absolute_errors = math_ops.abs(predictions - labels)
896 def mean_cosine_distance(labels,
903 """Computes the cosine distance between the labels and predictions.
907 between `predictions` and `labels`. This average is weighted by `weights`,
918 labels: A `Tensor` of arbitrary shape.
919 predictions: A `Tensor` of the same shape as `labels`.
922 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
923 be either `1`, or the same as the corresponding `labels` dimension). Also,
938 ValueError: If `predictions` and `labels` have mismatched shapes, or if
948 predictions, labels, weights = _remove_squeezable_dimensions(
949 predictions=predictions, labels=labels, weights=weights)
950 radial_diffs = math_ops.multiply(predictions, labels)
970 def mean_per_class_accuracy(labels,
988 labels: A `Tensor` of ground truth labels with shape [batch size] and of
990 predictions: A `Tensor` of prediction results for semantic labels, whose
993 num_classes: The possible number of labels the prediction task can
997 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
998 be either `1`, or the same as the corresponding `labels` dimension).
1011 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1022 (predictions, labels, weights)):
1023 labels = math_ops.cast(labels, dtypes.int64)
1026 if labels.get_shape().ndims > 1:
1027 labels = array_ops.reshape(labels, [-1])
1033 predictions.get_shape().assert_is_compatible_with(labels.get_shape())
1038 ones = array_ops.ones([array_ops.size(labels)], dtypes.float32)
1040 if labels.dtype != predictions.dtype:
1041 predictions = math_ops.cast(predictions, labels.dtype)
1043 math_ops.equal(predictions, labels), dtypes.float32)
1053 update_total_op = state_ops.scatter_add(total, labels, ones)
1054 update_count_op = state_ops.scatter_add(count, labels, is_correct)
1075 def mean_iou(labels,
1098 labels: A `Tensor` of ground truth labels with shape [batch size] and of
1100 predictions: A `Tensor` of prediction results for semantic labels, whose
1103 num_classes: The possible number of labels the prediction task can
1107 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1108 be either `1`, or the same as the corresponding `labels` dimension).
1120 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1131 (predictions, labels, weights)):
1133 predictions.get_shape().assert_is_compatible_with(labels.get_shape())
1135 labels, predictions,
1178 def mean_relative_error(labels,
1196 absolute value of the differences between `predictions` and `labels` by the
1204 labels: A `Tensor` of the same shape as `predictions`.
1208 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1209 be either `1`, or the same as the corresponding `labels` dimension).
1223 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1233 predictions, labels, weights = _remove_squeezable_dimensions(
1234 predictions=predictions, labels=labels, weights=weights)
1240 math_ops.equal(normalizer, 0.0), array_ops.zeros_like(labels),
1241 math_ops.div(math_ops.abs(labels - predictions), normalizer))
1247 def mean_squared_error(labels,
1253 """Computes the mean squared error between the labels and predictions.
1264 element-wise square of the difference between `predictions` and `labels`. Then
1272 labels: A `Tensor` of the same shape as `predictions`.
1275 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1276 be either `1`, or the same as the corresponding `labels` dimension).
1290 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1300 predictions, labels, weights = _remove_squeezable_dimensions(
1301 predictions=predictions, labels=labels, weights=weights)
1302 squared_error = math_ops.squared_difference(labels, predictions)
1368 predictions=values, labels=None, weights=weights)
1494 def false_negatives(labels,
1505 labels: The ground truth values, a `Tensor` whose dimensions must match
1510 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1511 be either `1`, or the same as the corresponding `labels` dimension).
1533 (predictions, labels, weights)):
1535 predictions, labels, weights = _remove_squeezable_dimensions(
1537 labels=math_ops.cast(labels, dtype=dtypes.bool),
1540 math_ops.equal(labels, True), math_ops.equal(predictions, False))
1546 def false_negatives_at_thresholds(labels,
1558 labels: A `Tensor` whose shape matches `predictions`. Will be cast to
1564 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1565 be either `1`, or the same as the corresponding `labels` dimension).
1578 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1589 (predictions, labels, weights)):
1591 labels, predictions, thresholds, weights=weights, includes=('fn',))
1602 def false_positives(labels,
1613 labels: The ground truth values, a `Tensor` whose dimensions must match
1618 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1619 be either `1`, or the same as the corresponding `labels` dimension).
1631 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1642 (predictions, labels, weights)):
1644 predictions, labels, weights = _remove_squeezable_dimensions(
1646 labels=math_ops.cast(labels, dtype=dtypes.bool),
1649 math_ops.equal(labels, False), math_ops.equal(predictions, True))
1655 def false_positives_at_thresholds(labels,
1667 labels: A `Tensor` whose shape matches `predictions`. Will be cast to
1673 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1674 be either `1`, or the same as the corresponding `labels` dimension).
1687 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1698 (predictions, labels, weights)):
1700 labels, predictions, thresholds, weights=weights, includes=('fp',))
1711 def true_negatives(labels,
1722 labels: The ground truth values, a `Tensor` whose dimensions must match
1727 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1728 be either `1`, or the same as the corresponding `labels` dimension).
1740 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1751 (predictions, labels, weights)):
1753 predictions, labels, weights = _remove_squeezable_dimensions(
1755 labels=math_ops.cast(labels, dtype=dtypes.bool),
1758 math_ops.equal(labels, False), math_ops.equal(predictions, False))
1764 def true_negatives_at_thresholds(labels,
1776 labels: A `Tensor` whose shape matches `predictions`. Will be cast to
1782 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1783 be either `1`, or the same as the corresponding `labels` dimension).
1796 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1807 (predictions, labels, weights)):
1809 labels, predictions, thresholds, weights=weights, includes=('tn',))
1820 def true_positives(labels,
1831 labels: The ground truth values, a `Tensor` whose dimensions must match
1836 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1837 be either `1`, or the same as the corresponding `labels` dimension).
1849 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1860 (predictions, labels, weights)):
1862 predictions, labels, weights = _remove_squeezable_dimensions(
1864 labels=math_ops.cast(labels, dtype=dtypes.bool),
1867 math_ops.equal(labels, True), math_ops.equal(predictions, True))
1873 def true_positives_at_thresholds(labels,
1885 labels: A `Tensor` whose shape matches `predictions`. Will be cast to
1891 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1892 be either `1`, or the same as the corresponding `labels` dimension).
1905 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1916 (predictions, labels, weights)):
1918 labels, predictions, thresholds, weights=weights, includes=('tp',))
1929 def precision(labels,
1935 """Computes the precision of the predictions with respect to the labels.
1951 labels: The ground truth values, a `Tensor` whose dimensions must match
1956 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
1957 be either `1`, or the same as the corresponding `labels` dimension).
1972 ValueError: If `predictions` and `labels` have mismatched shapes, or if
1983 (predictions, labels, weights)):
1985 predictions, labels, weights = _remove_squeezable_dimensions(
1987 labels=math_ops.cast(labels, dtype=dtypes.bool),
1991 labels,
1998 labels,
2024 def precision_at_thresholds(labels,
2037 entry in `labels` is `True`, divided by the total weight of values in
2048 labels: The ground truth values, a `Tensor` whose dimensions must match
2054 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
2055 be either `1`, or the same as the corresponding `labels` dimension).
2069 ValueError: If `predictions` and `labels` have mismatched shapes, or if
2080 (predictions, labels, weights)):
2082 labels, predictions, thresholds, weights, includes=('tp', 'fp'))
2105 def recall(labels,
2111 """Computes the recall of the predictions with respect to the labels.
2125 labels: The ground truth values, a `Tensor` whose dimensions must match
2130 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
2131 be either `1`, or the same as the corresponding `labels` dimension).
2146 ValueError: If `predictions` and `labels` have mismatched shapes, or if
2157 (predictions, labels, weights)):
2158 predictions, labels, weights = _remove_squeezable_dimensions(
2160 labels=math_ops.cast(labels, dtype=dtypes.bool),
2164 labels,
2171 labels,
2241 def _maybe_select_class_id(labels, predictions_idx, selected_id=None):
2245 labels: `int64` `Tensor` or `SparseTensor` with shape
2247 target classes for the associated prediction. Commonly, N=1 and `labels`
2256 Tuple of `labels` and `predictions_idx`, possibly with classes removed.
2259 return labels, predictions_idx
2260 return (_select_class_id(labels, selected_id),
2264 def _sparse_true_positive_at_k(labels,
2277 labels
2279 target classes for the associated prediction. Commonly, N=1 and `labels`
2284 match `labels`.
2287 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
2288 dimensions must be either `1`, or the same as the corresponding `labels`
2296 (predictions_idx, labels, weights)):
2297 labels, predictions_idx = _maybe_select_class_id(labels, predictions_idx,
2299 tp = sets.set_size(sets.set_intersection(predictions_idx, labels))
2309 def _streaming_sparse_true_positive_at_k(labels,
2320 `n` label classes, where `n` is the 2nd dimension of `labels`.
2325 labels: `int64` `Tensor` or `SparseTensor` with shape
2327 target classes for the associated prediction. Commonly, N=1 and `labels`
2332 match `labels`.
2336 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
2337 dimensions must be either `1`, or the same as the corresponding `labels`
2348 (predictions_idx, labels, weights)) as scope:
2351 labels=labels,
2360 def _sparse_false_negative_at_k(labels,
2372 labels: `int64` `Tensor` or `SparseTensor` with shape
2374 target classes for the associated prediction. Commonly, N=1 and `labels`
2379 match `labels`.
2382 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
2383 dimensions must be either `1`, or the same as the corresponding `labels`
2390 (predictions_idx, labels, weights)):
2391 labels, predictions_idx = _maybe_select_class_id(labels, predictions_idx,
2394 sets.set_difference(predictions_idx, labels, aminusb=False))
2404 def _streaming_sparse_false_negative_at_k(labels,
2415 `n` label classes, where `n` is the 2nd dimension of `labels`.
2420 labels: `int64` `Tensor` or `SparseTensor` with shape
2422 target classes for the associated prediction. Commonly, N=1 and `labels`
2427 match `labels`.
2431 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
2432 dimensions must be either `1`, or the same as the corresponding `labels`
2443 (predictions_idx, labels, weights)) as scope:
2446 labels=labels,
2456 def recall_at_k(labels,
2464 """Computes recall@k of the predictions with respect to sparse labels.
2470 average a class among the labels of a batch entry is in the top-k
2484 `labels` calculate the true positives and false negatives weighted by
2491 labels: `int64` `Tensor` or `SparseTensor` with shape
2494 the associated prediction. Commonly, N=1 and `labels` has shape
2502 must match `labels`.
2508 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
2509 dimensions must be either `1`, or the same as the corresponding `labels`
2535 (predictions, labels, weights)) as scope:
2538 labels=labels,
2549 def recall_at_top_k(labels,
2557 """Computes recall@k of top-k predictions with respect to sparse labels.
2564 labels: `int64` `Tensor` or `SparseTensor` with shape
2567 the associated prediction. Commonly, N=1 and `labels` has shape
2575 match `labels`.
2581 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
2582 dimensions must be either `1`, or the same as the corresponding `labels`
2603 (predictions_idx, labels, weights)) as scope:
2604 labels = _maybe_expand_labels(labels, predictions_idx)
2608 labels=labels,
2614 labels=labels,
2633 def recall_at_thresholds(labels,
2646 `labels` is `True`, divided by the total weight of `True` values in `labels`
2655 labels: The ground truth values, a `Tensor` whose dimensions must match
2661 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
2662 be either `1`, or the same as the corresponding `labels` dimension).
2676 ValueError: If `predictions` and `labels` have mismatched shapes, or if
2687 (predictions, labels, weights)):
2689 labels, predictions, thresholds, weights, includes=('tp', 'fn'))
2711 def root_mean_squared_error(labels,
2717 """Computes the root mean squared error between the labels and predictions.
2728 the element-wise square of the difference between `predictions` and `labels`.
2736 labels: A `Tensor` of the same shape as `predictions`.
2739 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
2740 be either `1`, or the same as the corresponding `labels` dimension).
2754 ValueError: If `predictions` and `labels` have mismatched shapes, or if
2764 predictions, labels, weights = _remove_squeezable_dimensions(
2765 predictions=predictions, labels=labels, weights=weights)
2766 mse, update_mse_op = mean_squared_error(labels, predictions, weights, None,
2782 def sensitivity_at_specificity(labels,
2802 found in the `predictions` and `labels`.
2810 labels: The ground truth values, a `Tensor` whose dimensions must match
2816 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
2817 be either `1`, or the same as the corresponding `labels` dimension).
2834 ValueError: If `predictions` and `labels` have mismatched shapes, if
2848 (predictions, labels, weights)):
2856 labels, predictions, thresholds, weights)
2937 def _num_relevant(labels, k):
2938 """Computes number of relevant values for each row in labels.
2940 For labels with shape [D1, ... DN, num_labels], this is the minimum of
2944 labels: `int64` `Tensor` or `SparseTensor` with shape
2946 target classes for the associated prediction. Commonly, N=1 and `labels`
2959 with ops.name_scope(None, 'num_relevant', (labels,)) as scope:
2961 labels = sparse_tensor.convert_to_tensor_or_sparse_tensor(labels)
2962 if isinstance(labels, sparse_tensor.SparseTensor):
2963 return math_ops.minimum(sets.set_size(labels), k, name=scope)
2966 # tile across labels shape.
2967 labels_shape = array_ops.shape(labels)
2973 def _sparse_average_precision_at_top_k(labels, predictions_idx):
2974 """Computes average precision@k of predictions with respect to sparse labels.
2982 `labels`, and the result `Tensors`. In the common case, this is [batch_size].
2986 labels: `int64` `Tensor` or `SparseTensor` with shape
2989 the associated prediction. Commonly, N=1 and `labels` has shape
2995 [D1, ... DN] must match `labels`. Values should be in range
3006 (predictions_idx, labels)) as scope:
3014 labels = _maybe_expand_labels(labels, predictions_idx)
3022 # Replicate labels k times to produce [D1, ... DN, k, num_labels] tensor.
3024 labels, multiple=k, dim=-1, name='labels_per_k')
3058 num_relevant_items = math_ops.cast(_num_relevant(labels, k), dtypes.float64)
3062 def _streaming_sparse_average_precision_at_top_k(labels,
3068 """Computes average precision@k of predictions with respect to sparse labels.
3078 `precision_at_<k>`. Set operations applied to `top_k` and `labels` calculate
3086 labels: `int64` `Tensor` or `SparseTensor` with shape
3089 the associated prediction. Commonly, N=1 and `labels` has shape
3095 match `labels`. Values should be in range [0, num_classes).
3097 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
3098 dimensions must be either `1`, or the same as the corresponding `labels`
3113 (predictions_idx, labels, weights)) as scope:
3116 predictions_idx=predictions_idx, labels=labels)
3157 def sparse_average_precision_at_k(labels,
3166 labels=labels,
3176 def average_precision_at_k(labels,
3183 """Computes average precision@k of predictions with respect to sparse labels.
3195 `labels` calculate the true positives and false positives weighted by
3202 labels: `int64` `Tensor` or `SparseTensor` with shape
3205 the associated prediction. Commonly, N=1 and `labels` has shape
3212 for each class. [D1, ... DN] must match `labels`.
3216 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
3217 dimensions must be either `1`, or the same as the corresponding `labels`
3242 (predictions, labels, weights)) as scope:
3246 labels=labels,
3254 def _sparse_false_positive_at_k(labels,
3266 labels: `int64` `Tensor` or `SparseTensor` with shape
3268 target classes for the associated prediction. Commonly, N=1 and `labels`
3273 match `labels`.
3276 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
3277 dimensions must be either `1`, or the same as the corresponding `labels`
3284 (predictions_idx, labels, weights)):
3285 labels, predictions_idx = _maybe_select_class_id(labels, predictions_idx,
3288 sets.set_difference(predictions_idx, labels, aminusb=True))
3298 def _streaming_sparse_false_positive_at_k(labels,
3309 `n` label classes, where `n` is the 2nd dimension of `labels`.
3314 labels: `int64` `Tensor` or `SparseTensor` with shape
3316 target classes for the associated prediction. Commonly, N=1 and `labels`
3321 match `labels`.
3325 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
3326 dimensions must be either `1`, or the same as the corresponding `labels`
3337 (predictions_idx, labels, weights)) as scope:
3340 labels=labels,
3350 def precision_at_top_k(labels,
3358 """Computes precision@k of the predictions with respect to sparse labels.
3365 labels: `int64` `Tensor` or `SparseTensor` with shape
3368 the associated prediction. Commonly, N=1 and `labels` has shape
3375 [D1, ... DN] must match `labels`.
3382 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
3383 dimensions must be either `1`, or the same as the corresponding `labels`
3409 (predictions_idx, labels, weights)) as scope:
3410 labels = _maybe_expand_labels(labels, predictions_idx)
3414 labels=labels,
3420 labels=labels,
3440 def sparse_precision_at_k(labels,
3450 labels=labels,
3461 def precision_at_k(labels,
3469 """Computes precision@k of the predictions with respect to sparse labels.
3490 `labels` calculate the true positives and false positives weighted by
3497 labels: `int64` `Tensor` or `SparseTensor` with shape
3500 the associated prediction. Commonly, N=1 and `labels` has shape
3507 must match `labels`.
3514 `labels`. If the latter, it must be broadcastable to `labels` (i.e., all
3515 dimensions must be either `1`, or the same as the corresponding `labels`
3541 (predictions, labels, weights)) as scope:
3544 labels=labels,
3555 def specificity_at_sensitivity(labels,
3575 found in the `predictions` and `labels`.
3583 labels: The ground truth values, a `Tensor` whose dimensions must match
3589 `labels`, and must be broadcastable to `labels` (i.e., all dimensions must
3590 be either `1`, or the same as the corresponding `labels` dimension).
3607 ValueError: If `predictions` and `labels` have mismatched shapes, if
3621 (predictions, labels, weights)):
3629 labels, predictions, thresholds, weights)