Tensorflow.js tf.metrics.sparseCategoricalAccuracy() Function
Tensorflow.js is an open-source library developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.
The .metrics.sparseCategoricalAccuracy() function is sparse categorical accuracy metric function which uses indices and logits in order to return tf.Tensor object.
- yTrue: It is the stated true labels i.e. indices and it can be of type tf.Tensor.
- yPred: It is the predicted expectancies or logits and it can be of type tf.Tensor.
Return Value: It returns the tf.Tensor object.
Tensor [0, 1, 1, 0]
Tensor [0, 0, 1, 0]