Sparse categorical accuracy metric function.
Example:
const yTrue = tf.tensor1d([1, 1, 2, 2, 0]);const yPred = tf.tensor2d( [[0, 1, 0], [1, 0, 0], [0, 0.4, 0.6], [0, 0.6, 0.4], [0.7, 0.3, 0]]);const crossentropy = tf.metrics.sparseCategoricalAccuracy(yTrue, yPred);crossentropy.print(); Copy
const yTrue = tf.tensor1d([1, 1, 2, 2, 0]);const yPred = tf.tensor2d( [[0, 1, 0], [1, 0, 0], [0, 0.4, 0.6], [0, 0.6, 0.4], [0.7, 0.3, 0]]);const crossentropy = tf.metrics.sparseCategoricalAccuracy(yTrue, yPred);crossentropy.print();
True labels: indices.
Predicted probabilities or logits.
Accuracy tensor.
Generated using TypeDoc
Sparse categorical accuracy metric function.
Example: