Add metrics page to user guide#671
Conversation
Adds a when-to-use guide for skill metrics: how they differ, which metric answers which question, and common pitfalls. Resolves the request in #670. - New docs/user-guide/metrics.qmd with a live intro example and reference tables grouped by metric family, verified against src/modelskill/metrics.py - Wire into the User Guide sidebar in docs/_quarto.yml - Link from docs/user-guide/index.qmd Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ecomodeller
left a comment
There was a problem hiding this comment.
Nice with a metrics page. Take this opportunity to fix the details of the ranges in the docstrings for some of the metrics.
| |---|---|---|---|---| | ||
| | `si` | `scatter_index` | [0, ∞) | 0 | Scatter index = `urmse / mean(obs)`. Random error as a fraction of the mean. | | ||
| | `mape` | `mean_absolute_percentage_error` | [0, ∞) | 0 | Mean absolute % error, `mean(\|model−obs\| / \|obs\|)`. Intuitive %, but blows up near obs = 0. | | ||
| | `scatter_index2` | — | [0, 100] | 0 | Alternative SI formulation (centred, normalised by `Σobs²`). Less common. | |
There was a problem hiding this comment.
Double check that [0, 100] is correct, I think it should
| | `r2` | — | (−∞, 1] | 1 | Coefficient of determination. Identical to NSE (see gotcha below). | | ||
| | `kge` | `kling_gupta_efficiency` | (−∞, 1] | 1 | Kling–Gupta — composite of **correlation + bias ratio + variability ratio**. | | ||
| | `willmott` | — | [0, 1] | 1 | Willmott's Index of Agreement — bounded [0,1], less harsh on bias than NSE. | | ||
| | `ev` | `explained_variance` | [0, 1] | 1 | Proportion of variance explained (differs from NSE when the model is biased). | |
There was a problem hiding this comment.
Same comment as above. Are limits correct? I think this one can be negative.
Avoids an interlink to modelskill.options, which is not in the quartodoc inventory and produced a build warning. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Responds to @ecomodeller's review on #671. Docstring range fixes in metrics.py: - explained_variance: [0, 1] -> (-inf, 1] (can be negative) - scatter_index2: [0, 100] -> [0, inf) - c_max_error: [0, inf) -> [0, 180] (circular error is bounded) User-guide metrics page: - Combine metric + alias into one column; every name now links to its API entry (via interlinks) for easy navigation - Slim the Range/Best columns with table-layout CSS so the 'What it is' column gets the room it needs - Apply the corrected ranges; add ranges to the circular table - New 'cc, ev and r2: a nested hierarchy' section answering the core question from #670 (cc^2 >= ev >= r2, and why) Also document scatter_index2 and mean_absolute_percentage_error in the API reference so the new links resolve. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks @ecomodeller! Addressed in 0523cb5: Range fixes — both the docstrings in
I went through every metric against the source; the rest checked out. Table layout — metric + alias are now a single column, Range/Best are slimmed via API navigation — every metric name is now an interlink to its entry in the metrics API reference. (Had to add Bonus — added a short |
|
@ecomodeller should we remove scatter_index2 from the user guide? (I guess it is only there for backwards compatibility) |
It exists only for backward compatibility and isn't recommended, so it doesn't belong in a when-to-use guide. Also revert documenting it in the API reference (it was only added there to resolve the page link). The docstring range fix in metrics.py is kept for accuracy. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@ryan-kipawa any comments before I merge this? |
Closes #670.
Adds a Metrics page to the user guide — a when-to-use guide for skill metrics: how they differ (e.g. the
evvsccvsr2question from the issue), which metric answers which question, and common pitfalls. Based on the draft attached to #670, reviewed and aligned with the rest of the user guide.What's included
docs/user-guide/metrics.qmdstatistics.qmd)docs/_quarto.yml, after Statistics)docs/user-guide/index.qmdReview notes
src/modelskill/metrics.py; the default skill set matchesdefault_metrics.r2is the coefficient of determination (= NSE), not squared correlation — surfaced as a callout.🤖 Generated with Claude Code