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

revamp entire metrics #3868

Merged
merged 27 commits into from
Oct 6, 2020
Merged

revamp entire metrics #3868

merged 27 commits into from
Oct 6, 2020

Conversation

ananyahjha93
Copy link
Contributor

@ananyahjha93 ananyahjha93 commented Oct 5, 2020

Co-authored-by: Teddy Koker teddy.koker@gmail.com

What does this PR do?

Deletes metrics

Fixes #3877

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 your PR does only one thing, instead of bundling different changes together? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

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?

Always 💯
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 🙃

@ananyahjha93 ananyahjha93 added feature Is an improvement or enhancement priority: 0 High priority task v1.0 allowed labels Oct 5, 2020
@mergify mergify bot requested a review from a team October 5, 2020 15:04
@pep8speaks
Copy link

pep8speaks commented Oct 5, 2020

Hello @ananyahjha93! Thanks for updating this PR.

Line 184:17: W503 line break before binary operator
Line 185:17: W503 line break before binary operator

Comment last updated at 2020-10-06 19:47:07 UTC

@codecov
Copy link

codecov bot commented Oct 5, 2020

Codecov Report

Merging #3868 into master will decrease coverage by 4%.
The diff coverage is 76%.

@@           Coverage Diff           @@
##           master   #3868    +/-   ##
=======================================
- Coverage      88%     83%    -4%     
=======================================
  Files         117     108     -9     
  Lines        9147    8666   -481     
=======================================
- Hits         8007    7215   -792     
- Misses       1140    1451   +311     

Copy link
Member

@justusschock justusschock left a comment

Choose a reason for hiding this comment

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

I really like the new interface. I only had some minor comments (e.g. let's keep functional metrics for now, some naming stuff and some type annotations). I assume docstrings will be added later?

pytorch_lightning/metrics/classification/accuracy.py Outdated Show resolved Hide resolved
pytorch_lightning/metrics/classification/accuracy.py Outdated Show resolved Hide resolved
pytorch_lightning/metrics/classification/accuracy.py Outdated Show resolved Hide resolved
pytorch_lightning/metrics/classification/accuracy.py Outdated Show resolved Hide resolved
tests/metrics/functional/test_nlp.py Show resolved Hide resolved
tests/metrics/functional/test_reduction.py Show resolved Hide resolved
tests/metrics/functional/test_regression.py Show resolved Hide resolved
@mergify mergify bot requested a review from a team October 5, 2020 19:04
Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

we rather move the actual metrics to pl.legacy.metrics then completely before we fill all metrics we had before...
do the same with metric tests aka tests.legacy.metrics

@mergify mergify bot requested a review from a team October 5, 2020 20:03
@ananyahjha93
Copy link
Contributor Author

ananyahjha93 commented Oct 5, 2020

@justusschock we are probably going to deprecate functional metric as with the whole update, reset and compute format, functional metrics don't make sense. If you want a single function to compute your metric value:

acc = Accuracy()

for batch in dataloader:
    step_acc_val = acc(preds, target)

Having a functional API with epoch aggregation and ddp sync per step doesn't make sense

@mergify
Copy link
Contributor

mergify bot commented Oct 6, 2020

This pull request is now in conflict... :(

@justusschock
Copy link
Member

justusschock commented Oct 6, 2020

@ananyahjha93 the functional API does none of these things. It's just batch in, Value out and I really would keep these (same reason why pytorch has functionals of their loss functions).

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.

PR is looking good. Really like many of the changes.

Question: is the idea to do to the hole update in this PR or just lay out the foundation for the metric package here, and the follow up with PRs for individual metrics?

As @justusschock has already mentioned in his review, I see 3 major breaking changes that we at least need to discuss:

  1. Do we completely remove the functional interface?
  2. Do we remove support for numpy arrays (by removing NumpyMetric subclass)?
  3. If 2 is true, I assume we also remove sklearn interface?

pytorch_lightning/metrics/metric.py Show resolved Hide resolved
pytorch_lightning/metrics/metric.py Show resolved Hide resolved
pytorch_lightning/metrics/metric.py Outdated Show resolved Hide resolved
pytorch_lightning/metrics/regression/mean_error.py Outdated Show resolved Hide resolved
ananyahjha93 and others added 9 commits October 6, 2020 15:31
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker teddy.koker@gmail.com
Co-authored-by: Teddy Koker teddy.koker@gmail.com
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
ananyahjha93 and others added 16 commits October 6, 2020 15:31
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
@ananyahjha93 ananyahjha93 changed the title [wip] revamp entire metrics revamp entire metrics Oct 6, 2020
@williamFalcon williamFalcon merged commit f76bc52 into master Oct 6, 2020
awaelchli pushed a commit that referenced this pull request Oct 6, 2020
* removed metric

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* added new metrics

Co-authored-by: Teddy Koker teddy.koker@gmail.com

* pep8

Co-authored-by: Teddy Koker teddy.koker@gmail.com

* pep8

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* docs

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* docs

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* win ddp tests skip

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* win ddp tests skip

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* win ddp tests skip

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* win ddp tests skip

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* reset in compute, cache compute

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* reduce_ops handling

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* sync -> sync_dist, type annotations

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* wip docs

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* mean squared error

* docstring

* added mean ___ error metrics

* added mean ___ error metrics

* seperated files

* accuracy doctest

* gpu fix

* remove unnecessary mixin

* metric and accuracy docstring

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* metric docs

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* pep8, changelog

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* refactor dist utils, pep8

* refactor dist utils, pep8

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
@Borda Borda deleted the metrics_revamp branch October 6, 2020 23:00
williamFalcon added a commit that referenced this pull request Oct 7, 2020
* base

* add xfail

* new test

* import

* missing import

* xfail if not installed


include mkpatch


fix test

* mock comet


comet mocks


fix test


remove dep


undo merge duplication

* line

* line

* convert doctest

* doctest

* docs

* prune Results usage in notebooks (#3911)

* notebooks

* notebooks

* revamp entire metrics (#3868)

* removed metric

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* added new metrics

Co-authored-by: Teddy Koker teddy.koker@gmail.com

* pep8

Co-authored-by: Teddy Koker teddy.koker@gmail.com

* pep8

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* docs

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* docs

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* win ddp tests skip

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* win ddp tests skip

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* win ddp tests skip

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* win ddp tests skip

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* reset in compute, cache compute

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* reduce_ops handling

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* sync -> sync_dist, type annotations

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* wip docs

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* mean squared error

* docstring

* added mean ___ error metrics

* added mean ___ error metrics

* seperated files

* accuracy doctest

* gpu fix

* remove unnecessary mixin

* metric and accuracy docstring

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* metric docs

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* pep8, changelog

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* refactor dist utils, pep8

* refactor dist utils, pep8

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>

* Callback docs with autosummary (#3908)

* callback docs with autosummary

* do not show private methods

* callback base docstring

* skip some docker builds (temporally pass) (#3913)

* skip some docker builds

* todos

* skip

* use badges only with push (#3914)

* testtube

* mock test tube

* mock mlflow

* remove mlflow

* clean up

* test

* test

* test

* test

* test

* test

* code blocks

* remove import

* codeblock

* logger

* wandb causes stall

Co-authored-by: William Falcon <waf2107@columbia.edu>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Ananya Harsh Jha <ananya@pytorchlightning.ai>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Jeff Yang <ydcjeff@outlook.com>
@AtlantixJJ
Copy link

Hi guys, I just install the pytorch-lightning package with the latest version in master, but found out that the metrics.functional was gone and the metrics were almost empty.

Is that true for the moment due to the revamping?

Would you recommend a usable version as of now? Thanks

@Borda Borda mentioned this pull request Oct 7, 2020
@Borda Borda added this to the 0.10.0 milestone Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement priority: 0 High priority task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

merge new metrics API
9 participants