MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / call

Method call

tensorflow/contrib/eager/python/metrics_impl.py:474–499  ·  view source on GitHub ↗

Accumulate accuracy statistics. `labels` and `predictions` should have the same shape and type. Args: labels: Binary Tensor(containing 0 or 1). predictions: Tensor with probabilities or logits. weights: Optional weighting of each example. Defaults to 1. Returns:

(self, labels, predictions, weights=None)

Source from the content-addressed store, hash-verified

472 self.threshold = threshold
473
474 def call(self, labels, predictions, weights=None):
475 """Accumulate accuracy statistics.
476
477 `labels` and `predictions` should have the same shape and type.
478
479 Args:
480 labels: Binary Tensor(containing 0 or 1).
481 predictions: Tensor with probabilities or logits.
482 weights: Optional weighting of each example. Defaults to 1.
483
484 Returns:
485 The arguments, for easy chaining.
486 """
487 check_ops.assert_equal(
488 array_ops.shape(labels), array_ops.shape(predictions),
489 message="Shapes of labels and predictions are unequal")
490 predictions = ops.convert_to_tensor(predictions)
491 predictions = predictions > self.threshold
492 # Convert labels to bool to match predictions.
493 labels = math_ops.cast(labels, dtypes.bool)
494 matches = math_ops.equal(labels, predictions)
495 matches = math_ops.cast(matches, self.dtype)
496 super(BinaryAccuracy, self).call(matches, weights=weights)
497 if weights is None:
498 return labels, predictions
499 return labels, predictions, weights
500
501
502class SparseAccuracy(Mean):

Callers

nothing calls this directly

Calls 5

assert_equalMethod · 0.80
equalMethod · 0.80
shapeMethod · 0.45
castMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected