All problems
Nash-Sutcliffe Efficiency
Problem
Compute the Nash-Sutcliffe efficiency: 1 - SSE(model) / SSE(mean), where SSE(mean) uses the mean of actual.
Return 0.0 when actual is empty or has zero variance.
Hint
Using the mean of actual as the benchmark is equivalent to R squared.
Test cases
case 1
in: [[1,2,3,4],[1,2,3,4]]
expected: 1
case 2
in: [[1,2,3,4],[2,2,2,2]]
expected: -0.19999999999999996
case 3
in: [[3,3,3],[3,3,3]]
expected: 0
case 4
in: [[1,2],[2,1]]
expected: -3
Starter codePython
def nash_sutcliffe(actual, forecast):
# Your code here
pass4 test cases · run your code against them in the editor