Example #1
0
def _recall_at_threshold(labels, predictions, weights, threshold, name=None):
  with ops.name_scope(
      name, 'recall_at_%s' % threshold,
      (predictions, labels, weights, threshold)) as scope:
    precision_tensor, update_op = metrics_lib.recall_at_thresholds(
        labels=labels, predictions=predictions, thresholds=(threshold,),
        weights=weights, name=scope)
    return array_ops.squeeze(precision_tensor), array_ops.squeeze(update_op)
Example #2
0
def _recall_at_threshold(labels, predictions, weights, threshold, name=None):
  with ops.name_scope(
      name, 'recall_at_%s' % threshold,
      (predictions, labels, weights, threshold)) as scope:
    precision_tensor, update_op = metrics_lib.recall_at_thresholds(
        labels=labels, predictions=predictions, thresholds=(threshold,),
        weights=weights, name=scope)
    return array_ops.squeeze(precision_tensor), array_ops.squeeze(update_op)
Example #3
0
def _recall_at_thresholds(predictions, targets, weights=None):
    return metrics.recall_at_thresholds(labels=targets,
                                        predictions=array_ops.slice(
                                            predictions, [0, 1], [-1, 1]),
                                        thresholds=np.arange(0,
                                                             1,
                                                             0.01,
                                                             dtype=np.float32),
                                        weights=weights)
 def _metric_fn(x):
   labels = x["labels"]
   predictions = x["predictions"]
   return metrics.recall_at_thresholds(labels, predictions, [0.5])
Example #5
0
 def _metric_fn(x):
     labels = x["labels"]
     predictions = x["predictions"]
     return metrics.recall_at_thresholds(labels, predictions, [0.5])
Example #6
0
def _recall_at_thresholds(predictions, targets, weights=None):
  return metrics.recall_at_thresholds(
      labels=targets,
      predictions=array_ops.slice(predictions, [0, 1], [-1, 1]),
      thresholds=np.arange(0, 1, 0.01, dtype=np.float32),
      weights=weights)