Computes the precision of the predictions with respect to the labels.
Example:
const x = tf.tensor2d( [ [0, 0, 0, 1], [0, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 0] ]);const y = tf.tensor2d( [ [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 1, 0, 0], [0, 1, 0, 0] ]);const precision = tf.metrics.precision(x, y);precision.print(); Copy
const x = tf.tensor2d( [ [0, 0, 0, 1], [0, 1, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0], [0, 0, 1, 0] ]);const y = tf.tensor2d( [ [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 1, 0, 0], [0, 1, 0, 0] ]);const precision = tf.metrics.precision(x, y);precision.print();
The ground truth values. Expected to contain only 0-1 values.
The predicted values. Expected to contain only 0-1 values.
Precision Tensor.
Generated using TypeDoc
Computes the precision of the predictions with respect to the labels.
Example: