Interface Metric

All Known Implementing Classes:
Accuracy, AUC, BaseMetric, BinaryAccuracy, BinaryCrossentropy, CategoricalAccuracy, CategoricalCrossentropy, CategoricalHinge, CosineSimilarity, FalseNegatives, FalsePositives, Hinge, KLDivergence, LogCoshError, Mean, MeanAbsoluteError, MeanAbsolutePercentageError, MeanIoU, MeanRelativeError, MeanSquaredError, MeanSquaredLogarithmicError, MeanTensor, Poisson, Precision, PrecisionAtRecall, Recall, RecallAtPrecision, RootMeanSquaredError, SensitivityAtSpecificity, SparseCategoricalAccuracy, SparseCategoricalCrossentropy, SparseTopKCategoricalAccuracy, SpecificityAtSensitivity, SquaredHinge, Sum, TopKCategoricalAccuracy, TrueNegatives, TruePositives

public interface Metric
Interface for metrics
  • Method Details

    • updateStateList

      List<Op> updateStateList(Ops tf, Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights)
      Creates a List of Operations to update the metric state based on input values.
      Parameters:
      tf - the TensorFlow Ops encapsulating a Graph environment. encapsulating a Graph environment.
      values - the inputs to be passed to update state, this may not be null
      sampleWeights - sample weights to be applied to values, may be null.
      Returns:
      a List of Operations to update the metric state
      Throws:
      IllegalArgumentException - if the TensorFlow Ops scope does not have a Graph environment.
    • updateStateList

      List<Op> updateStateList(Ops tf, Operand<? extends TNumber> labels, Operand<? extends TNumber> predictions, Operand<? extends TNumber> sampleWeights)
      Creates a List of Operations to update the metric state based on labels and predictions.

      This is an empty implementation that should be overridden in a sub class, if needed.

      Parameters:
      tf - the TensorFlow Ops encapsulating a Graph environment.
      labels - the labels
      predictions - the predictions
      sampleWeights - sample weights to be applied to values, may be null.
      Returns:
      a List of Operations to update the metric state
      Throws:
      IllegalArgumentException - if the TensorFlow Ops scope does not have a Graph environment.
    • result

      <T extends TNumber> Operand<T> result(Ops tf, Class<T> type)
      Gets the current result of the metric
      Type Parameters:
      T - the date type for the result
      Parameters:
      tf - the TensorFlow Ops encapsulating a Graph environment.
      type - the data type for the result
      Returns:
      the result, possibly with control dependencies
      Throws:
      IllegalArgumentException - if the TensorFlow Ops scope does not have a Graph environment.
    • resetStates

      Op resetStates(Ops tf)
      Resets any state variables to their initial values
      Parameters:
      tf - the TensorFlow Ops encapsulating a Graph environment.
      Returns:
      the operation for doing the reset
      Throws:
      IllegalArgumentException - if the TensorFlow Ops scope does not have a Graph environment.
    • updateState

      Op updateState(Ops tf, Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights)
      Creates a NoOp Operation with control dependencies to update the metric state
      Parameters:
      tf - the TensorFlow Ops encapsulating a Graph environment.
      values - the inputs to be passed to update state, this may not be null
      sampleWeights - sample weights to be applied to values, may be null.
      Returns:
      the Operation to update the metric state
      Throws:
      IllegalArgumentException - if the TensorFlow Ops scope does not have a Graph environment.
    • updateState

      Op updateState(Ops tf, Operand<? extends TNumber> labels, Operand<? extends TNumber> predictions, Operand<? extends TNumber> sampleWeights)
      Creates a NoOp Operation with control dependencies to update the metric state
      Parameters:
      tf - the TensorFlow Ops encapsulating a Graph environment.
      labels - the labels
      predictions - the predictions
      sampleWeights - sample weights to be applied to values, may be null.
      Returns:
      the Operation to update the metric state
      Throws:
      IllegalArgumentException - if the TensorFlow Ops scope does not have a Graph environment.
    • callOnce

      <T extends TNumber> Operand<T> callOnce(Ops tf, Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights, Class<T> type)
      Calls update state once, followed by a call to get the result
      Type Parameters:
      T - the date type for the result
      Parameters:
      tf - the TensorFlow Ops encapsulating a Graph environment.
      values - the inputs to be passed to update state, this may not be null
      sampleWeights - sample weights to be applied to values, may be null.
      type - the data type for the result
      Returns:
      the result, possibly with control dependencies
      Throws:
      IllegalArgumentException - if the TensorFlow Ops scope does not have a Graph environment.