Tensorflow.js tf.metrics.meanAbsoluteError() Function
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 tf.metrics.meanAbsoluteError() is used to calculate mean absolute error. The mean absolute error is defined as the mean of absolute difference of two tensors. Where, the mean is applied over feature dimensions. It takes two tensors as a parameter.
mean(abs(Prediction - True))
- Tensor1: It is the truth tensor.
- Tensor2: It is the Prediction tensor.
Return Value: It returns the tensor of the mean absolute errors.
Example 1: In this example, we are giving two 1d tensors as a parameter, and the metrics.meanAbsoluteError function will calculate the mean absolute error and return a tensor.
Example 2: In this example, we are giving two 2d tensors as a parameter, and the metrics.meanAbsoluteError function will calculate the mean absolute error and return a tensor.
Tensor [1.3333334, 1.6666667]