'Calculate Nash-Sutcliff-Efficiency

I have two arrays which shapes are both(220, 6), how to calculate the NSE(Nash-Sutcliff-Efficiency)? I know how to calculate when it has one column, as follows:

denominator = np.sum((a1 - np.mean(a1)) ** 2)
numerator = np.sum((a2 - a1) ** 2)
nse_val = 1 - numerator / denominator

Does this also work for arrays which have more columns?



Solution 1:[1]

Here is function I use for Nash-Sutcliffe Efficiency (NSE) calculation,

def nse(predictions, targets):
    return (1-(np.sum((predictions-targets)**2)/np.sum((targets-np.mean(targets))**2))

Tested for 1d and 2d numpy arrays without any NaN's.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1