A Julia package providing error / performance metrics for comparing model outputs with observations.
- Loss & skill metrics: MSE, NSE/NNSE (and inverse forms for minimization)
- Correlation metrics: Pearson and Spearman (and squared / normalized variants)
- Optional uncertainty weighting: variants that accept observational uncertainty
yσ - Simple, extensible API: dispatch on metric types via
metric(m, ŷ, y[, yσ])
using Pkg
Pkg.add("ErrorMetrics")using ErrorMetrics
using Random
y = randn(100) # observations
ŷ = y .+ 0.1randn(100) # model output
mse = metric(MSE(), ŷ, y)
nse = metric(NSE(), ŷ, y)
pcor = metric(Pcor(), ŷ, y)
# with observational uncertainty
yσ = 0.2 .* ones(100)
nseσ = metric(NSEσ(), ŷ, y, yσ)MSE: Mean Squared Error: Measures the average squared difference between predicted and observed valuesNAME1R: Normalized Absolute Mean Error with 1/R scaling: Measures the absolute difference between means normalized by the range of observationsNMAE1R: Normalized Mean Absolute Error with 1/R scaling: Measures the average absolute error normalized by the range of observationsNSE: Nash-Sutcliffe Efficiency: Measures model performance relative to the mean of observationsNSEInv: Inverse Nash-Sutcliffe Efficiency: Inverse of NSE for minimization problemsNSEσ: Nash-Sutcliffe Efficiency with uncertainty: Incorporates observation uncertainty in the performance measureNSEσInv: Inverse Nash-Sutcliffe Efficiency with uncertainty: Inverse of NSEσ for minimization problemsNNSE: Normalized Nash-Sutcliffe Efficiency: Measures model performance relative to the mean of observations, normalized to [0,1] rangeNNSEInv: Inverse Normalized Nash-Sutcliffe Efficiency: Inverse of NNSE for minimization problems, normalized to [0,1] rangeNNSEσ: Normalized Nash-Sutcliffe Efficiency with uncertainty: Incorporates observation uncertainty in the normalized performance measureNNSEσInv: Inverse Normalized Nash-Sutcliffe Efficiency with uncertainty: Inverse of NNSEσ for minimization problemsPcor: Pearson Correlation: Measures linear correlation between predictions and observationsPcorInv: Inverse Pearson Correlation: Inverse of Pcor for minimization problemsPcor2: Squared Pearson Correlation: Measures the strength of linear relationship between predictions and observationsPcor2Inv: Inverse Squared Pearson Correlation: Inverse of Pcor2 for minimization problemsScor: Spearman Correlation: Measures monotonic relationship between predictions and observationsScorInv: Inverse Spearman Correlation: Inverse of Scor for minimization problemsScor2: Squared Spearman Correlation: Measures the strength of monotonic relationship between predictions and observationsScor2Inv: Inverse Squared Spearman Correlation: Inverse of Scor2 for minimization problemsNPcor: Normalized Pearson Correlation: Measures linear correlation between predictions and observations, normalized to [0,1] rangeNPcorInv: Inverse Normalized Pearson Correlation: Inverse of NPcor for minimization problemsNScor: Normalized Spearman Correlation: Measures monotonic relationship between predictions and observations, normalized to [0,1] rangeNScorInv: Inverse Normalized Spearman Correlation: Inverse of NScor for minimization problems
For detailed documentation, see the ErrorMetrics.jl documentation.
This package is licensed under the EUPL-1.2 (European Union Public Licence v. 1.2). See the LICENSE file for details.
Contributions are welcome! Please open an issue or pull request in this repository.