Commit Graph

144 Commits

Author SHA1 Message Date
Carlos Mocholí 47c76548aa
Sync our torchmetrics wrappers after the 0.4 release (#8205)
Co-authored-by: Jirka <jirka.borovec@seznam.cz>
2021-06-29 22:05:48 +00:00
Adrian Wälchli b978d2a1f2
remove message (#8163) 2021-06-28 09:57:52 +00:00
Jirka Borovec 4f3af42f83
better use of void (#7809)
* use void

* format
2021-06-08 15:36:50 +00:00
Jirka Borovec 96981091c7
Prune deprecated classif. metrics (#7499)
* stat_scores_multiple_classes

* precision_recall

* precision

* recall

* auc

* auroc

* multiclass_auroc

* iou

* clean-up

* chlog

* flake8

* imports

* prune
2021-05-12 18:03:34 +00:00
Jirka Borovec aa7d3dc6cc
Fix `torchmetrics` compatibility (#7131)
* get_num_classes

* tmp

* fix one test

* fix deprecated tests

* fix deprecate

* pep8

* deprecate 0.3

* wip

* wip

* HaCK

* brnch

* brnch

* format

* Apply suggestions from code review

* prune

* rev

* mltilabel

* Apply suggestions from code review

* master

* rev

* .

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
2021-04-22 20:45:46 +00:00
Jirka Borovec 0b843848b6
less IDE complain about unused args (#6786)
* less IDE complain about unused args

* ...
2021-04-01 18:19:00 +02:00
Jirka Borovec 217c12a4e7
Simplify deprecations (#6620)
* use external deprecate

* simplify

* simplify

* simplify

* flake8

* .

* others

* .
2021-03-25 15:26:38 +01:00
Jirka Borovec 70beddfc13
Prune metrics: others 11/DoNe (#6659)
* classif

* grad_img

* nlp

* ssl

* format
2021-03-24 09:16:28 +01:00
Jirka Borovec a74909affa
prune metrics: info retrieval (#6649) 2021-03-23 15:05:32 +00:00
Jirka Borovec f93414d085
Prune metyrics: regression 9/n (#6637)
* psnr

* r2score

* ssim

* chlog
2021-03-23 10:01:25 +00:00
Jirka Borovec efce2b7777
Prune metrics: regression 8/n (#6636)
* explained_variance

* tests

* mean_absolute_error

* mean_squared_error

* mean_relative_error

* mean_squared_log_error

* chlog
2021-03-23 09:35:51 +01:00
Jirka Borovec 3a56a6024e
Prune metrics: other classification 7/n (#6584)
* confusion_matrix

* iou

* f_beta

* hamming_distance

* stat_scores

* tests

* flake8

* chlog
2021-03-20 03:18:52 +05:30
Jirka Borovec 38a2119359
Prune metrics: precision & recall 6/n (#6573)
* avg precision

* precision
* recall

* curve

* tests

* chlog

* isort

* fix
2021-03-18 13:21:59 -04:00
Jirka Borovec 9e35f979ea
Prune metrics: AUC & AUROC (#6572)
* class: AUC AUROC

* func: auc auroc

* format

* tests
2021-03-18 10:38:56 +01:00
Jirka Borovec 2f6ce1ae7f
prune metric: accuracy 4/n (#6515)
* prune accuracy

* chlog

* flake8

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* wrap

* test

* test

* fix

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
2021-03-17 11:37:10 +00:00
Jirka Borovec 555a6fea21
prune warning & deprecation wrapper (#6540)
* docs

* wrapper

* test

* count

* flake8
2021-03-16 14:55:31 +00:00
Jirka Borovec a312219d42
Prune metric: helpers and inputs 3/n (#6547)
* _basic_input_validation

* _check_shape_and_type_consistency

* _check_num_classes_binary

* _check_num_classes_mc

* _check_num_classes_ml

* _check_top_k

* _check_classification_inputs

* _input_format_classification

* _reduce_stat_scores

* DataType

* rest

* flake8

* chlog
2021-03-16 13:54:06 +01:00
Jirka Borovec 6453091b8a
Prune metrics base classes 2/n (#6530)
* base class

* extensions

* chlog

* _stable_1d_sort

* _check_same_shape

* _input_format_classification_one_hot

* utils

* to_onehot

* select_topk

* to_categorical

* get_num_classes

* reduce

* class_reduce

* tests
2021-03-15 19:28:18 +00:00
Jirka Borovec b341b53f70
deprecate metrics pkg (#6505)
* deprecate metrics

* examples

* req

* docs

* Apply suggestions from code review

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* pep8

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
2021-03-15 14:39:38 +00:00
Luca Di Liello 5d73fbbd81
Mean Average Precision metric for Information Retrieval (1/5) (#5032)
* init information retrieval metrics

* changed retrieval metrics names, expanded arguments and fixed typo

* added 'Retrieval' prefix to metrics and fixed conflict with already-present 'average_precision' file

* improved code formatting

* pep8 code compatibility

* features/implemented new Mean Average Precision metrics for Information Retrieval + doc

* fixed pep8 compatibility

* removed threshold parameter and fixed typo on types in RetrievalMAP and improved doc

* improved doc, put first class-specific args in RetrievalMetric and transformed RetrievalMetric in abstract class

* implemented tests for functional and class metric. fixed typo when input tensors are empty or when all targets are False

* fixed typos in doc and changed torch.true_divide to torch.div

* fixed typos pep8 compatibility

* fixed types in long division in ir_average_precision and example in mean_average_precision

* RetrievalMetric states are not lists and _metric method accepts predictions and targets for easier extension

* updated CHANGELOG file

* added '# noqa: F401' flag to not used imports

* added double space before '# noqa: F401' flag

* Update CHANGELOG.md

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* change get_mini_groups in get_group_indexes

* added checks on target inputs

* minor refactoring for code cleanness

* split tests over exception raising in separate function && refactored test code into multiple functions

* fixed pep8 compatibility

* implemented suggestions of @SkafteNicki

* fixed imports for isort and added types annontations to functions in test_map.py

* isort on test_map and fixed typing

* isort on retrieval and on __init__.py and utils.py in metrics package

* fixed typo in pytorch_lightning/metrics/__init__.py regarding code style

* fixed yapf compatibility

* fixed yapf compatibility

* fixed typo in doc

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-03-15 12:18:43 +01:00
Dipam Vasani 06756a84e6
document exceptions for metrics/functional (#6273)
* document exceptions for metrics/functional

* Apply suggestions from code review

Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Akihiro Nitta <nitta@akihironitta.com>
2021-03-15 12:07:52 +01:00
Dipam Vasani 8e3524d1a4
Document exception for metrics/classification (#6190)
* document exception for metrics/classification

* minor formatting fixes

* fix trailing whitespaces

* document exception for metrics

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Apply suggestions from code review

Co-authored-by: Akihiro Nitta <nitta@akihironitta.com>

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Akihiro Nitta <nitta@akihironitta.com>
2021-03-04 19:34:03 +00:00
Frankie Robertson 5d7388d43b
Fix when _stable_1d_sort to work when n >= N (#6177)
* Fix when _stable_1d_sort to work when n >= N

* Apply suggestions

Co-authored-by: Carlos Mocholi <carlossmocholi@gmail.com>
2021-03-04 14:18:57 -05:00
prajakta0111 15c477e9fc
document exceptions for metrics/regression (#6202)
Co-authored-by: Akihiro Nitta <nitta@akihironitta.com>
Co-authored-by: Prajakta Phadke <pphadke@iu.edu>
Co-authored-by: Rohit Gupta <rohitgr1998@gmail.com>
2021-02-28 20:22:26 +05:30
Jirka Borovec a731269056
Prune deprecated metrics for 1.3 (#6161)
* prune deprecated metrics for 1.3

* isort / yapf
2021-02-24 11:09:01 +00:00
Akihiro Nitta 1d28d11a07
Minor fixes/improvements in Metric docs (#6114)
* Fix wrong render

* Improve classification metrics docs

* Improve other domain metrics docs

* Change the structure level in the docs
2021-02-22 16:50:59 +08:00
Philip E Blair 77f6aa43e5
Fix: Allow hashing of metrics with lists in their state (#5939)
* Fix: Allow hashing of metrics with lists in their state

* Add test case and modify semantics of Metric __hash__ in order to be compatible with structural equality checks

* Fix pep8 style issue

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-18 09:54:12 +00:00
manipopopo 6a9cec41a3
Add `dim` to `pytorch_lightning.metrics.PSNR` (#5957)
* Add dim to PSNR

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Add reduction tests

* Recover warnings on reduction and add tests

* Add copyright texts

* Refactor PSNR

* Change warnings

* Update pytorch_lightning/metrics/functional/psnr.py

Change functional.psnr dim doc

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Change PSNR dim docs

* Apply suggestions from code review

* tests

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-02-17 11:55:40 +01:00
Adrian Wälchli 4bdf2fe55f
remove executable bit on source files (#5929)
* 644
2021-02-12 00:06:40 +01:00
Nicki Skafte 0c80b9f890
fix metric docs (#5880) 2021-02-11 14:32:12 +00:00
Jirka Borovec b434c479e7
Quantisation (#5706)
* empty

* sq

* obs


* int

* ts

* helpers

* chlog

* yapf

* avg

* dupl

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Apply suggestions from code review

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* fixes

* Apply suggestions from code review

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* fixes

* note

* warn

* 45

* link

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* Apply suggestions from code review

Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

* yapf

* flake8

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>
2021-02-11 07:04:57 -05:00
Nicki Skafte 605c5a8c9a Fix `num_classes` arg in F1 metric (#5663)
* fix f1 metric

* Apply suggestions from code review

* chlog

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-02-05 21:40:30 +01:00
Jirka Borovec e633787a3d flake8 + yapf 2021-02-04 20:55:58 +01:00
manipopopo 97e1516349 Fix Metric.state_dict (#5614)
* Fix Metric.state_dict

* Update CHANGELOG.md

* Update CHANGELOG.md

* Detach tensors in a list if needed

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

(cherry picked from commit e87424adfb)
2021-02-04 20:55:41 +01:00
yuntai 50fd4879a9
Update metrics to use Enum (#5689)
- Add DataType, AverageMethod and MDMCAverageMethod
2021-02-01 13:50:10 -05:00
Jirka Borovec 963c17b669
formatting 6/n: metrics (#5722)
* yapf metrics

* op
2021-02-01 09:24:07 +01:00
Nicki Skafte 221c4a0ba2
[Metrics] AUC/AUROC class interface (#5479)
* base files

* auc done

* init files

* auc class interface

* fixing auc

* more fixes

* working auroc

* update auc

* add docs

* remove leftovers from merge

* suggestions

* fix f-string

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* add deprecated tests

* make logic clearer

* Update pytorch_lightning/metrics/classification/auroc.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* fix

* fix

* fix docs

* fix isort

* fix deprecated test

* fix tests

* fix tests

* fix isort

* Apply suggestions from code review

* add enum

* deprecate old impl

* update from suggestions

* chlog

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-01-27 08:16:54 -05:00
Jirka Borovec dee5553b2b
move to Pages dir (#4869)
* folders

* common / advanced / extensions

* paths

* flake8

* isort

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-01-26 15:07:07 -05:00
Justus Schock 8c55a08e85
Compositional metrics (#5464)
* implement compositional metrics

* implement composition functions for metrics

* test compositions

* docs

* pytest

* pep8

* fix argument resolution

* return all kwargs if filtering not possible

* fix typo

* implement hashing

* Update pytorch_lightning/metrics/compositional.py

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* Update docs/source/metrics.rst

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* add representation

* Apply suggestions from code review

* Update docs/source/metrics.rst

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* chlog

* flake8

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-01-26 11:56:12 -05:00
Arnaud Gelas 61e1d8772d
Fix isort failures in metrics (#5528)
Remove from skipped module in pyproject.toml and fix failures on:
- pytorch_lightning/metrics/*.py
2021-01-18 07:10:53 -05:00
Tadej Svetina c8f605e47d
Classification metrics overhaul: precision & recall (4/n) (#4842)
* Add stuff

* Change metrics documentation layout

* Add stuff

* Add stat scores

* Change testing utils

* Replace len(*.shape) with *.ndim

* More descriptive error message for input formatting

* Replace movedim with permute

* PEP 8 compliance

* WIP

* Add reduce_scores function

* Temporarily add back legacy class_reduce

* Division with float

* PEP 8 compliance

* Remove precision recall

* Replace movedim with permute

* Add back tests

* Add empty newlines

* Add precision recall back

* Add empty line

* Fix permute

* Fix some issues with old versions of PyTorch

* Style changes in error messages

* More error message style improvements

* Fix typo in docs

* Add more descriptive variable names in utils

* Change internal var names

* Revert unwanted changes

* Revert unwanted changes pt 2

* Update metrics interface

* Add top_k parameter

* Add back reduce function

* Add stuff

* PEP3

* Add depreciation

* PEP8

* Deprecate param

* PEP8

* Fix and simplify testing for older PT versions

* Update Changelog

* Remove redundant import

* Add tests to increase coverage

* Remove zero_division

* fix zero_division

* Add zero_div + edge case tests

* Reorder cls metric args

* Add back quotes for is_multiclass

* Add precision_recall and tests

* PEP8

* Fix docs

* Fix docs

* Update

* Change precision_recall output

* PEP8/isort

* Add method _get_final_stats

* Fix depr test

* Add comment to deprecation tests

* isort

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Add typing to test

* Add matc str to pytest.raises

Co-authored-by: chaton <thomas@grid.ai>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-18 03:24:13 -05:00
Nicki Skafte 02acb21e55
[Metrics] Disable default reset after compute (#5409)
* reset

* self._cache -> cache (make cache local variable so it is not overwritten)

* pep8

* fix metric result integration

* rm print statements

* better comment

* changelog

* Update docs/source/metrics.rst

Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>

Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2021-01-13 04:01:08 -05:00
deng-cy 3ee1b55bf1
Reformat iou [func] and add IoU class (#4704)
* added Iou

* Create iou.py

* Update iou.py

* Update iou.py

* Update CHANGELOG.md

* Update metrics.rst

* Update iou.py

* Update iou.py

* Update __init__.py

* Update iou.py

* Update iou.py

* Update classification.py

* Update classification.py

* Update classification.py

* Update __init__.py

* Update __init__.py

* Update iou.py

* Update classification.py

* Update metrics.rst

* Update CHANGELOG.md

* Update CHANGELOG.md

* add iou

* add test

* add test

* removed iou

* add iou

* add iou test

* add float

* reformat test_iou

* removed test_iou

* updated format

* updated format

* Update CHANGELOG.md

* updated format

* Update metrics.rst

* Apply suggestions from code review

merge suggestions

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* added equations

* reformat init

* change format

* change format

* deprecate iou and test for this

* fix changelog

* delete iou test in test_classification

* format change

* format change

* format

* format

* format

* delete white space

* delete white space

* fix tests

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* better deprecation

* fix docs

* Apply suggestions from code review

* fix todo

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-08 13:36:08 +00:00
Nicki Skafte 06668c0ddf
[Metrics] MetricCollection (#4318)
* docs + precision + recall + f_beta + refactor

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

* rebase

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

* fixes

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

* added missing file

* docs

* docs

* extra import

* add metric collection

* add docs + integration with log_dict

* add test

* update

* update

* more test

* more test

* pep8

* fix doctest

* pep8

* add clone method

* add clone method

* merge-2

* changelog

* kwargs filtering and tests

* pep8

* fix test

* update docs

* Update docs/source/metrics.rst

Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>

* fix docs

* fix tests

* Apply suggestions from code review

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* fix docs

* fix doctest

* fix doctest

* fix doctest

* fix doctest

Co-authored-by: ananyahjha93 <ananya@pytorchlightning.ai>
Co-authored-by: Teddy Koker <teddy.koker@gmail.com>
Co-authored-by: Nicki Skafte <nugginea@gmail.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-01-08 11:09:07 +01:00
Pranjal Datta 06f36092a4
added image-gradients (#4763) [1/2] (#5056)
* added iamge-gradients (#4763)

* fixed tests code format

* made recommended fixes

* removed explicit device flags

* tried to fix doctest failure

* pep8 and doctest fixes

* added to docs/metrics

* updated CHANGELOG

* added the noqa flag

* added suggested modification to changelog

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* recommended update to docstring

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* removed device from docstring

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>

* made recommended fixes

* Update CHANGELOG.md

* Apply suggestions from code review

* added 1-line docstrings

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Roger Shieh <sh.rog@protonmail.ch>
2021-01-07 20:34:38 +01:00
Jirka Borovec 5ae6926a52
fix some minor typos in docs (#5369)
* fix docs typos

* Apply suggestions from code review

Co-authored-by: Wansoo Kim <rladhkstn8@gmail.com>

* flake8

Co-authored-by: Wansoo Kim <rladhkstn8@gmail.com>
2021-01-07 08:01:52 -05:00
Jirka Borovec 3c6e06be96
drop duplicated metric helper (#5366)
* drop duplicated metric helper

* .

* fix tests

Co-authored-by: Nicki Skafte <skaftenicki@gmail.com>
2021-01-06 18:49:59 -05:00
Abhik Banerjee b347b97e84 Updated metrics/classification/precision_recall.py (#5348)
There was a typo in Documentation of Code of the ```compute()``` function of ```Recall``` metric at line 210. It said "Computes accuracy over state." which should have been "Computes recall over state."

(cherry picked from commit d568533b6b)
2021-01-06 15:14:20 +01:00
Tadej Svetina 4292fe0532 Fix metric state reset (#5273)
* Fix metric state reset

* Fix test

* Improve formatting

Co-authored-by: Ananya Harsh Jha <ananya@pytorchlightning.ai>
(cherry picked from commit 4913cbb987)
2021-01-06 12:48:01 +01:00
Jirka Borovec f2c2a692e1
drop deprecated fbeta metrics (#5322)
* drop deprecated fbeta metrics

* flake8

* imports

* chlog
2021-01-02 00:49:23 +00:00