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 Summary
Modifier and TypeMethodDescriptioncallOnce(Ops tf, Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights, Class<T> type) Calls update state once, followed by a call to get the resultresetStates(Ops tf) Resets any state variables to their initial valuesGets the current result of the metricCreates a NoOp Operation with control dependencies to update the metric stateupdateState(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 stateupdateStateList(Ops tf, Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights) Creates a List of Operations to update the metric state based on input values.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.
-
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 aGraphenvironment. encapsulating aGraphenvironment.values- the inputs to be passed to update state, this may not be nullsampleWeights- 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 aGraphenvironment.labels- the labelspredictions- the predictionssampleWeights- 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
Gets the current result of the metric- Type Parameters:
T- the date type for the result- Parameters:
tf- the TensorFlow Ops encapsulating aGraphenvironment.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
Resets any state variables to their initial values- Parameters:
tf- the TensorFlow Ops encapsulating aGraphenvironment.- Returns:
- the operation for doing the reset
- Throws:
IllegalArgumentException- if the TensorFlow Ops scope does not have a Graph environment.
-
updateState
Creates a NoOp Operation with control dependencies to update the metric state- Parameters:
tf- the TensorFlow Ops encapsulating aGraphenvironment.values- the inputs to be passed to update state, this may not be nullsampleWeights- 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 aGraphenvironment.labels- the labelspredictions- the predictionssampleWeights- 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 aGraphenvironment.values- the inputs to be passed to update state, this may not be nullsampleWeights- 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.
-