Mean Squared Error
MediumMachine LearningMathArray
Description
Given equal-length arrays yTrue and yPred, return the mean squared error, rounded to 4 decimal places.
Examples
Input:
yTrue = [1,2,3], yPred = [1,2,3]Output:
0Explanation:
Averaging the squared differences between predictions and targets gives 0.
Input:
yTrue = [3,5,2], yPred = [2,5,4]Output:
1.6667Explanation:
Averaging the squared differences between predictions and targets gives 1.6667.
Input:
yTrue = [0,0], yPred = [1,1]Output:
1Explanation:
Averaging the squared differences between predictions and targets gives 1.
Constraints
- •
1 ≤ yTrue.length ≤ 10⁴