Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kling-Gupta Efficiency and differentiate between modified an unmodified #700

Merged
merged 5 commits into from
Mar 7, 2024

Conversation

martinvonk
Copy link
Collaborator

Short Description

See title.

Also deprecates kge_2012 in version 2.0

Checklist before PR can be merged:

@martinvonk martinvonk added this to the 2.0: Bolognese milestone Mar 6, 2024
@martinvonk martinvonk modified the milestones: 2.0: Bolognese, 1.5 Mar 6, 2024
Copy link

codacy-production bot commented Mar 6, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.63% (target: +0.00%) 96.49%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (92c7b8a) 6031 4511 74.80%
Head commit (a736028) 6108 (+77) 4607 (+96) 75.43% (+0.63%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#700) 57 55 96.49%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

You may notice some variations in coverage metrics with the latest Coverage engine update. For more details, visit the documentation

Copy link
Member

@raoulcollenteur raoulcollenteur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add references, otherwise fine with me

pastas/modelstats.py Outdated Show resolved Hide resolved
pastas/stats/metrics.py Show resolved Hide resolved
tests/test_metrics.py Outdated Show resolved Hide resolved
@raoulcollenteur
Copy link
Member

Hi @martinvonk, can you add the reference? Otherwise I think this is fine, i like the change to kge.

Cheers,
Raoul

@martinvonk
Copy link
Collaborator Author

Reference was in the notes but is now also present in the parametes list:

modified: bool, optional
    Use the modified KGE as proposed by :cite:t:`kling_runoff_2012`.
    According to the article this ensures that the bias and variability
    ratios are not cross-correlated, which otherwise may occur when inputs
    are biased.

Notes
-----
The (weighted) Kling-Gupta Efficiency :cite:t:`kling_runoff_2012` is
computed as follows:

.. math:: \\text{KGE} = 1 - \\sqrt{(r-1)^2 + (\\beta-1)^2 - (\\gamma-1)^2}

where :math:`\\beta = \\bar{x} / \\bar{y}` and :math:`\\gamma =
\\frac{\\bar{\\sigma}_x}{\\bar{\\sigma}_y}}`. If modified equals True,
:math:`\\gamma = \\frac{\\bar{\\sigma}_x / \\bar{x}}{\\bar{\\sigma}_y /
\\bar{y}}`. If weighted equals True, the weighted mean, variance and
pearson correlation are used.

@martinvonk
Copy link
Collaborator Author

Do we have a list somewhere where everything is listed which we intend to deprecate for Pastas 2.0?

@martinvonk martinvonk merged commit a2e178b into dev Mar 7, 2024
12 checks passed
@martinvonk martinvonk deleted the kge branch March 7, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants