Root Mean Squared Error

MediumMachine LearningMathArrayTree

Description

Given equal-length arrays yTrue and yPred, return the root mean squared error (square root of the mean squared error), rounded to 4 decimal places.

Examples

Input:yTrue = [1,2,3], yPred = [1,2,3]
Output:0
Explanation:

Taking the square root of the mean squared error gives 0.

Input:yTrue = [3,5,2], yPred = [2,5,4]
Output:1.291
Explanation:

Taking the square root of the mean squared error gives 1.291.

Input:yTrue = [0,0], yPred = [2,2]
Output:2
Explanation:

Taking the square root of the mean squared error gives 2.

Constraints

  • 1 ≤ yTrue.length ≤ 10⁴

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.