Tensorflow.js tf.metrics.meanSquaredError() 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 Tensorflow tf.metrics.meanSquaredError() function is a Loss or metric function used to Computes the mean squared error between y_true and y_pred. the y_true is a truth tensor and y_pred is the Prediction Tensor.
Parameters: This function accepts two parameters which are illustrated below:
- tensor1: It is the truth tensor (y_true).
- tensor2: It is the prediction tensor (y_pred).
Return Value: It returns the mean square error tensor between truth tensor and prediction tensor.
let truth = tf.tensor1d([6, 4]);
let prediction = tf.tensor1d([-3, -4]);
const mse = tf.metrics.meanSquaredError(truth, prediction);
let mse = tf.metrics.meanSquaredError(
tf.tensor1d([0, 1, 2, 3]),
tf.tensor1d([-8,-9, -10, -11])
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!