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 Thiel's U Statistic (Uncertainty) Metric #1337

Merged
merged 35 commits into from
Nov 19, 2022
Merged

Add Thiel's U Statistic (Uncertainty) Metric #1337

merged 35 commits into from
Nov 19, 2022

Conversation

shenoynikhil
Copy link
Contributor

@shenoynikhil shenoynikhil commented Nov 15, 2022

What does this PR do?

Implements Theil's U statistic for nominal (categorical) data.
Fixes #1273

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

src/torchmetrics/nominal/thiels_u.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/nominal/thiels_u.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/nominal/thiels_u.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/nominal/thiels_u.py Outdated Show resolved Hide resolved
@stancld stancld added this to the v0.12 milestone Nov 15, 2022
@shenoynikhil shenoynikhil marked this pull request as ready for review November 18, 2022 06:26
Copy link
Member

@SkafteNicki SkafteNicki left a comment

Choose a reason for hiding this comment

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

LGTM

src/torchmetrics/functional/nominal/theils_u.py Outdated Show resolved Hide resolved
@SkafteNicki
Copy link
Member

@stancld please re-review :]

Borda and others added 2 commits November 18, 2022 10:43
Co-authored-by: Nicki Skafte Detlefsen <[email protected]>
@Borda Borda enabled auto-merge (squash) November 18, 2022 09:45
@codecov
Copy link

codecov bot commented Nov 18, 2022

Codecov Report

Merging #1337 (51e21d3) into master (1ab660e) will decrease coverage by 53%.
The diff coverage is 100%.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1337     +/-   ##
========================================
- Coverage      87%     33%    -53%     
========================================
  Files         208     210      +2     
  Lines       11695   11765     +70     
========================================
- Hits        10134    3921   -6213     
- Misses       1561    7844   +6283     

Copy link
Contributor

@stancld stancld left a comment

Choose a reason for hiding this comment

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

LGTM! Very nice, thanks for the contribution!

src/torchmetrics/functional/__init__.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/__init__.py Outdated Show resolved Hide resolved
src/torchmetrics/functional/nominal/theils_u.py Outdated Show resolved Hide resolved
@stancld
Copy link
Contributor

stancld commented Nov 18, 2022

Also, can we add a link for this metric to docs/source/links.rst? -- https://en.wikipedia.org/wiki/Uncertainty_coefficient

@SkafteNicki SkafteNicki modified the milestones: v0.12, v0.11 Nov 18, 2022
@shenoynikhil
Copy link
Contributor Author

shenoynikhil commented Nov 18, 2022

@stancld @SkafteNicki I was wondering why in each of these (crammers_v, pearson, theils_u), we have the exact same update function. Would it make sense to have a common one so that it can be put into utils.py. I am referring to the following functions,

  • _pearsons_contingency_coefficient_update
  • _cramers_v_update
  • _theils_u_update

@mergify mergify bot added the ready label Nov 19, 2022
@Borda Borda merged commit 96862e0 into Lightning-AI:master Nov 19, 2022
@shenoynikhil shenoynikhil deleted the shenoy/theils_u branch November 19, 2022 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Uncertainty coefficient (Theil's U)
4 participants