Class TrueNegatives<T extends TNumber>
java.lang.Object
org.tensorflow.framework.metrics.BaseMetric
org.tensorflow.framework.metrics.TrueNegatives<T>
- Type Parameters:
T- The data type for the metric result
- All Implemented Interfaces:
Metric
Metric that calculates the number of true negatives.
If sampleWeights is given, calculates the sum of the weights of true negatives. This
metric creates one local variable, accumulator that is used to keep track of the number
of true negatives.
If sampleWeights is null, weights default to 1. Use sampleWeights of 0
to mask values.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTrueNegatives(float[] thresholds, long seed, Class<T> type) Creates a TrueNegatives metric, usingClass.getSimpleName()for the metric nameTrueNegatives(float threshold, long seed, Class<T> type) Creates a TrueNegatives metric, usingClass.getSimpleName()for the metric nameTrueNegatives(long seed, Class<T> type) Creates a TrueNegatives metric, usingClass.getSimpleName()for the metric name and a default threshold ofDEFAULT_THRESHOLD.TrueNegatives(String name, float[] thresholds, long seed, Class<T> type) Creates a TrueNegatives metricTrueNegatives(String name, float threshold, long seed, Class<T> type) Creates a TrueNegatives metricTrueNegatives(String name, long seed, Class<T> type) Creates a TrueNegatives metric, using a default threshold ofDEFAULT_THRESHOLD. -
Method Summary
Modifier and TypeMethodDescriptionGets the accumulatorNamefloat[]get the thresholdsprotected voidInitialize the TensorFlow OpsresetStates(Ops tf) Resets any state variables to their initial valuesGets the current result of the metricupdateStateList(Ops tf, Operand<? extends TNumber> labels, Operand<? extends TNumber> predictions, Operand<? extends TNumber> sampleWeights) Accumulates the metric statistics.Methods inherited from class BaseMetric
callOnce, checkIsGraph, getName, getSeed, getTF, getVariableName, isInitialized, setInitialized, setName, setTF, updateState, updateState, updateStateList
-
Field Details
-
ACCUMULATOR
- See Also:
-
DEFAULT_THRESHOLD
public static final float DEFAULT_THRESHOLD- See Also:
-
-
Constructor Details
-
TrueNegatives
Creates a TrueNegatives metric, usingClass.getSimpleName()for the metric name and a default threshold ofDEFAULT_THRESHOLD.- Parameters:
seed- the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and data type.type- the data type for the variables
-
TrueNegatives
Creates a TrueNegatives metric, usingClass.getSimpleName()for the metric name- Parameters:
threshold- a threshold value in the range[0, 1]. A threshold is compared with prediction values to determine the truth value of predictions (i.e., above the threshold istrue, below isfalse). One metric value is generated for each threshold valueseed- the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and data type.type- the data type for the variables
-
TrueNegatives
Creates a TrueNegatives metric, usingClass.getSimpleName()for the metric name- Parameters:
thresholds- threshold values in the range[0, 1]. A threshold is compared with prediction values to determine the truth value of predictions (i.e., above the threshold istrue, below isfalse). One metric value is generated for each threshold valueseed- the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and data type.type- the data type for the variables
-
TrueNegatives
Creates a TrueNegatives metric, using a default threshold ofDEFAULT_THRESHOLD.- Parameters:
name- the name of the metric, if null thenClass.getSimpleName()is usedseed- the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and data type.type- the data type for the variables
-
TrueNegatives
Creates a TrueNegatives metric- Parameters:
name- the name of the metric, if null thenClass.getSimpleName()is usedthreshold- a threshold value in the range[0, 1]. A threshold is compared with prediction values to determine the truth value of predictions (i.e., above the threshold istrue, below isfalse). One metric value is generated for each threshold valueseed- the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and data type.type- the data type for the variables
-
TrueNegatives
Creates a TrueNegatives metric- Parameters:
name- the name of the metric, if null thenClass.getSimpleName()is usedthresholds- threshold values in the range[0, 1]. A threshold is compared with prediction values to determine the truth value of predictions (i.e., above the threshold istrue, below isfalse). One metric value is generated for each threshold valueseed- the seed for random number generation. An initializer created with a given seed will always produce the same random tensor for a given shape and data type.type- the data type for the variables
-
-
Method Details
-
init
Initialize the TensorFlow Ops- Specified by:
initin classBaseMetric- Parameters:
tf- the TensorFlow Ops encapsulating aGraphenvironment.
-
updateStateList
public List<Op> updateStateList(Ops tf, Operand<? extends TNumber> labels, Operand<? extends TNumber> predictions, Operand<? extends TNumber> sampleWeights) Accumulates the metric statistics.- Specified by:
updateStateListin interfaceMetric- Overrides:
updateStateListin classBaseMetric- Parameters:
tf- the TensorFlow Ops encapsulating aGraphenvironment.labels- The ground truth values.predictions- the predictionssampleWeights- Optional weighting of each example. Defaults to 1. Rank is either 0, or the same rank as labels, and must be broadcastable to labels.- Returns:
- a List of Operations to update the metric state.
-
result
Gets the current result of the metric- Type Parameters:
U- 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
-
resetStates
-
getThresholds
public float[] getThresholds()get the thresholds- Returns:
- the thresholds
-
getAccumulatorName
-