Metric

public abstract class Metric
Known Direct Subclasses
Known Indirect Subclasses

Base class for Metrics

Public Methods

final Operand<T>
callOnce(Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights)
Calls update state once, followed by a call to get the result
String
getName()
Gets the name of this metric.
long
getSeed()
Gets the random number generator seed value
Ops
getTF()
Gets the TensorFlow Ops
abstract Op
resetStates()
Resets any state variables to their initial values
abstract Operand<T>
result()
Gets the current result of the metric
final Op
updateState(Operand<? extends TNumber> labels, Operand<? extends TNumber> predictions, Operand<? extends TNumber> sampleWeights)
Creates a NoOp Operation with control dependencies to update the metric state
final Op
updateState(Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights)
Creates a NoOp Operation with control dependencies to update the metric state
List<Op>
updateStateList(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.
List<Op>
updateStateList(Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights)
Creates a List of Operations to update the metric state based on input values.

Inherited Methods

Public Methods

public final Operand<T> callOnce (Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights)

Calls update state once, followed by a call to get the result

Parameters
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 result, possibly with control dependencies

public String getName ()

Gets the name of this metric.

Returns
  • the name of this metric

public long getSeed ()

Gets the random number generator seed value

Returns
  • the random number generator seed value

public Ops getTF ()

Gets the TensorFlow Ops

Returns
  • the TensorFlow Ops

public abstract Op resetStates ()

Resets any state variables to their initial values

Returns
  • the control operation for doing the reset

public abstract Operand<T> result ()

Gets the current result of the metric

Returns
  • the result, possibly with control dependencies

public final Op updateState (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
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

public final Op updateState (Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights)

Creates a NoOp Operation with control dependencies to update the metric state

Parameters
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

public List<Op> updateStateList (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
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

public List<Op> updateStateList (Operand<? extends TNumber> values, Operand<? extends TNumber> sampleWeights)

Creates a List of Operations to update the metric state based on input values.

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

Parameters
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