![]() |
VOOZH | about |
Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment.
The Tensorflow.js tf.losses.logLoss() function calculates the log loss between two given tensors.
Syntax:
tf.losses.logLoss (labels, predictions, weights?, epsilon?, reduction?)
Parameters:
Return Value: It returns a tf.Tensor which is calculated by logLoss() function.
Example 1: In this example we will take two 2d tensors as labels and prediction. Then we will find the log loss of these two tensors.
Output:
Tensor 10.745397567749023
Example 2: In this example we will log loss of two given tensors and avoid taking log of zero using a small constant value, epsilon.