Skip to content
DeepForgeby svx
All problems
EasyML Fundamentalsml-099

Explained Sum of Squares

Problem

Compute the explained sum of squares of a regression: sum((pred_i - mean(y_true))^2).

Empty input returns 0.0.

Hint

Measure how far predictions spread around the mean of the true values.

Test cases

case 1
in: [[1,2,3],[1,2,3]]
expected: 2
case 2
in: [[1,2,3],[2,2,2]]
expected: 0
case 3
in: [[1,2,3,4],[1,3,3,3]]
expected: 3
case 4
in: [[],[]]
expected: 0
Starter codePython
def explained_sum_of_squares(y_true, y_pred):
    # Your code here
    pass

4 test cases · run your code against them in the editor