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 KLDivergence Metric #247

Merged
merged 19 commits into from
Jun 28, 2021
Merged

Add KLDivergence Metric #247

merged 19 commits into from
Jun 28, 2021

Conversation

hassiahk
Copy link
Contributor

@hassiahk hassiahk commented May 13, 2021

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?

What does this PR do?

Fixes #66.

PR review

Anyone in the community is free to review the PR tationonce 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 🙃

Things to do

This is just for my reference.

  • Minimal implementation
  • Add class interface
  • Add bindings to __init__ files
  • Add tests
  • Add documentation

@codecov
Copy link

codecov bot commented May 13, 2021

Codecov Report

Merging #247 (22145aa) into master (4fc3a7a) will decrease coverage by 0.13%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #247      +/-   ##
==========================================
- Coverage   96.64%   96.50%   -0.14%     
==========================================
  Files         107      109       +2     
  Lines        3428     3491      +63     
==========================================
+ Hits         3313     3369      +56     
- Misses        115      122       +7     
Flag Coverage Δ
Linux 75.52% <58.73%> (-0.31%) ⬇️
Windows 75.52% <58.73%> (-0.31%) ⬇️
cpu 96.44% <88.88%> (-0.14%) ⬇️
gpu 96.41% <88.88%> (-0.14%) ⬇️
macOS 96.44% <88.88%> (-0.14%) ⬇️
pytest 96.50% <88.88%> (-0.14%) ⬇️
python3.6 95.55% <88.88%> (-0.13%) ⬇️
python3.8 96.44% <88.88%> (-0.14%) ⬇️
python3.9 96.36% <88.88%> (-0.14%) ⬇️
torch1.3.1 95.55% <88.88%> (-0.13%) ⬇️
torch1.4.0 95.64% <88.88%> (-0.13%) ⬇️
torch1.9.0 96.36% <88.88%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
torchmetrics/__init__.py 100.00% <ø> (ø)
torchmetrics/classification/kldivergence.py 87.50% <87.50%> (ø)
...hmetrics/functional/classification/kldivergence.py 89.28% <89.28%> (ø)
torchmetrics/classification/__init__.py 100.00% <100.00%> (ø)
torchmetrics/functional/__init__.py 100.00% <100.00%> (ø)
torchmetrics/functional/classification/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4fc3a7a...22145aa. Read the comment docs.

@SkafteNicki SkafteNicki added enhancement New feature or request New metric labels May 14, 2021
@SkafteNicki SkafteNicki added this to the v0.4 milestone May 14, 2021
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.

Overall looks like a great start but still needs some more work :]

  • Add class interface
  • Add test
  • Add bindings to __init__ files
  • Add documentation

torchmetrics/functional/classification/kldivergence.py Outdated Show resolved Hide resolved
torchmetrics/functional/classification/kldivergence.py Outdated Show resolved Hide resolved
torchmetrics/functional/classification/kldivergence.py Outdated Show resolved Hide resolved
torchmetrics/functional/classification/kldivergence.py Outdated Show resolved Hide resolved
torchmetrics/functional/classification/kldivergence.py Outdated Show resolved Hide resolved
torchmetrics/functional/classification/kldivergence.py Outdated Show resolved Hide resolved
@Borda
Copy link
Member

Borda commented Jun 3, 2021

@hassiahk how is it going here, still a draft or ready for full review?

@Borda Borda requested a review from maximsch2 June 3, 2021 21:51
@hassiahk
Copy link
Contributor Author

hassiahk commented Jun 4, 2021

@Borda, it's been a busy last month for me. I need to add documentation, tests etc, once I am done I will make the PR available for full review. Thanks!!

@Borda
Copy link
Member

Borda commented Jun 9, 2021

it's been a busy last month for me. I need to add documentation, tests etc, once I am done I will make the PR available for full review. Thanks!!

that would be great to have it landed :]

@Borda
Copy link
Member

Borda commented Jun 15, 2021

@hassiahk we are aiming at release by end of this week, do you think we can get this land by that time?

@hassiahk
Copy link
Contributor Author

@Borda, really finding it hard to have time and work on this. I will try to complete but can't guarantee yet.

@pep8speaks
Copy link

pep8speaks commented Jun 26, 2021

Hello @hassiahk! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-06-28 09:59:45 UTC

@SkafteNicki
Copy link
Member

Hi @hassiahk,
I took the time to complete the PR with the remaining changes.
Thanks again for wanting to contribute :]

@SkafteNicki SkafteNicki marked this pull request as ready for review June 26, 2021 14:11
@hassiahk
Copy link
Contributor Author

I am really sorry for that @SkafteNicki. I was planning to do it today but thank you so much :)

@SkafteNicki
Copy link
Member

Do not be sorry, just trying to get some of the PRs done before next release.
If you still want to contribute, I can see that you also asked to be assigned #73 :]

@Borda
Copy link
Member

Borda commented Jun 28, 2021

seems that Linux and Windows tests are hanging...

@SkafteNicki SkafteNicki enabled auto-merge (squash) June 28, 2021 09:59
@SkafteNicki
Copy link
Member

@Borda should be good now :]

@SkafteNicki SkafteNicki merged commit cac72af into Lightning-AI:master Jun 28, 2021
@hassiahk hassiahk deleted the kld branch June 29, 2021 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add KLDivergence
4 participants