public class
Metrics
Helper class with built-in metrics functions.
Constants
| float | L2_NORM_EPSILON |
Public Constructors
|
Metrics()
|
Public Methods
| static <T extends TNumber> Operand<T> |
topKCategoricalAccuracy(Ops tf, Operand<? extends TNumber> labels, Operand<T> predictions, long k)
Computes how often targets are in the top K predictions.
|
Inherited Methods
Constants
public static final float L2_NORM_EPSILON
Constant Value:
1.0E-12
Public Constructors
public Metrics ()
Public Methods
public static Operand<T> topKCategoricalAccuracy (Ops tf, Operand<? extends TNumber> labels, Operand<T> predictions, long k)
Computes how often targets are in the top K predictions.
Standalone usage:
Operand<TInt32> labels = tf.constant(new int[][]
{ {0, 0, 1}, {0, 1, 0} });
Operand<TFloat32> predictions = tf.constant(new float[][]
{ {0.1f, 0.9f, 0.8f}, {0.05f, 0.95f, 0f} });
Operand<TFloat32> m = Metrics.topKCategoricalAccuracy(
labels, predictions, 3)
//m.shape().toString == "[2]"
Parameters
| tf | the TensorFlow Ops. |
|---|---|
| labels | the ground truth values. |
| predictions | The prediction values. |
| k | Number of top elements to look at for computing accuracy. |
Returns
- the Operand for the Top K categorical accuracy value.