goodness_of_fit
goodness_of_fit(observed, modeled, metrics='all', k=0)Goodness-of-fit metrics for a modeled series.
Mirrors the continuous metrics of the C# GoodnessOfFit class of the Numerics library.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| observed | array_like | Numeric vectors of equal length. | required |
| modeled | array_like | Numeric vectors of equal length. | required |
| metrics | str or sequence of str | "all" (the default) for every metric, or the metric names to keep, drawn from rmse, mse, mae, mape, smape, nse, log_nse, kge, kge_mod, pbias, rsr, pearson, r_squared, d, d_mod, d_ref, ve. A bare string is treated as a single metric name, not a sequence of characters. "all" (the default) evaluates every metric eagerly, including mape, which raises if observed contains a zero; ask for just the metrics you want to avoid that. |
'all' |
| k | int | Degrees-of-freedom correction subtracted from the sample size in the RMSE denominator. | 0 |
Returns
| Name | Type | Description |
|---|---|---|
| dict |
Examples
>>> from corehydropy import goodness_of_fit
>>> round(goodness_of_fit([2, 4, 6, 8, 10], [2.2, 3.9, 6.4, 7.5, 10.1])["nse"], 4)
0.9882