def _precision_at_threshold(labels, predictions, weights, threshold, name=None): with ops.name_scope( name, 'precision_at_%s' % threshold, (predictions, labels, weights, threshold)) as scope: precision_tensor, update_op = metrics_lib.precision_at_thresholds( labels=labels, predictions=predictions, thresholds=(threshold,), weights=weights, name=scope) return array_ops.squeeze(precision_tensor), array_ops.squeeze(update_op)
def _precision_at_threshold(labels, predictions, weights, threshold, name=None): with ops.name_scope( name, 'precision_at_%s' % threshold, (predictions, labels, weights, threshold)) as scope: precision_tensor, update_op = metrics_lib.precision_at_thresholds( labels=labels, predictions=predictions, thresholds=(threshold,), weights=weights, name=scope) return array_ops.squeeze(precision_tensor), array_ops.squeeze(update_op)
def _metric_fn(x): labels = x["labels"] predictions = x["predictions"] return metrics.precision_at_thresholds(labels, predictions, [0.5])
def _metric_fn(x): labels = x["labels"] predictions = x["predictions"] return metrics.precision_at_thresholds(labels, predictions, [0.5])
def _precision_at_thresholds(predictions, targets, weights=None): return metrics.precision_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 _precision_at_thresholds(predictions, targets, weights=None): return metrics.precision_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)