Граф коммитов

129 Коммитов

Автор SHA1 Сообщение Дата
Jirka Borovec b429dbdb2e
Refactor requirements (#130)
* docs

* test

* integrate

* devel

* - tm
2021-03-25 08:51:38 +01:00
Nicki Skafte 691b5d6eba
FBeta update (#111)
* update to statscore

* fix functional

* fix tests

* update

* fix tests

* formatting

* fix tests

* suggestions

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-03-24 15:32:50 -04:00
Nicki Skafte 2af13fb1b3
Multilabel support in ROC (#114)
* multilabel_roc_supp

* formatting

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
2021-03-23 20:41:31 +00:00
Nicki Skafte fc6c8ef124
add micro (#110) 2021-03-23 17:43:24 +00:00
Nicki Skafte 536357ccb4
[New metric] Matthews corrcoef (#98)
* init implementation

* files

* move file

* init files

* docs

* fix tests

* pep8

* Update CHANGELOG.md

* isort
2021-03-23 17:39:14 +01:00
Jirka Borovec 84cd7ffc82
update docs after transfer (#118)
* update docs after transfer

* ..
2021-03-22 10:18:06 +01:00
Luca Di Liello 60c0eec495 Mean Average Precision metric for Information Retrieval (1/5) (PL^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-22 09:22:07 +01:00
Frankie Robertson 8cf27b9441 Fix when _stable_1d_sort to work when n >= N (PL^6177)
* Fix when _stable_1d_sort to work when n >= N

* Apply suggestions

Co-authored-by: Carlos Mocholi <carlossmocholi@gmail.com>
2021-03-22 09:22:07 +01:00
Jirka Borovec be89a1b731
Refactor & cleaning (#109)
* typos

* code

* format
2021-03-18 19:56:43 +00:00
Jirka Borovec a1e50ca62b
simplify Tensor import (#108)
* versions

* simplify Tensor

* simplify tensor

* yapf
2021-03-18 20:34:25 +01:00
Jirka Borovec 264cc6f41e
unify checks (#91) 2021-03-17 11:28:49 +00:00
Nicki Skafte 02f0450de2
[New metric] CohenKappa (#69)
* cohen_kappa

* changelog

* pep8

* fix tests

* isort

* Update torchmetrics/functional/classification/cohen_kappa.py

Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Justus Schock <12886177+justusschock@users.noreply.github.com>
2021-03-15 19:54:52 +00:00
Jirka Borovec dfc85be4f6
CI: fix coverage config (#84)
* update coverage config

* Apply suggestions from code review
2021-03-15 13:01:39 +01:00
Jirka Borovec 6b192f2688 update req. 2021-03-15 08:52:44 +01:00
Jirka Borovec bb5ca011e1
CI: publish test results (#80)
* publish test results

* coverage

* ci
2021-03-14 22:51:16 +01:00
Nicki Skafte c32d3e5efb
Add prefix arg to metric collection (#70)
* prefix arg

* prefix arg

* Apply suggestions from code review

* chlog

* add types

* fix doctest

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-03-14 09:28:45 +01:00
Jirka Borovec 218242adb2 more tests 2021-03-11 15:11:05 +01:00
Jirka Borovec 466148bc72
use pytest-cov (#44)
* use pytest-cov

* req

* auc
2021-03-11 11:35:28 +01:00
Jirka Borovec 4dbf1e8408
fuse compositional (#25) 2021-03-05 11:39:13 +00:00
Jirka Borovec 06cfc14bce
add support for python 3.9 and PT 1.3 (#23)
* add support for python 3.9

* pt 1.3

* scikit

* flake8

* skips
2021-03-02 13:05:15 +00:00
Jirka Borovec 4bf6ed3382
minor refactor tests (#21)
* refactor tests

* rename
2021-03-01 08:42:17 +00:00
Nicki Skafte cdf58a1bd1
Refactor MetricCollection (#19)
* refactor

* chlog

* isort

* mypy

Co-authored-by: Jirka Borovec <jirka.borovec@seznam.cz>
2021-03-01 08:20:38 +00:00
Jirka Borovec 6b1a9ccb92
drop PL dependency (#13)
* drop PL dependency

* copy needed PL methods

* move prints

* docs
2021-02-24 10:41:22 +00:00
Jirka Borovec ddb8c51a36 add copyrights 2021-02-24 09:14:30 +01:00
Jirka Borovec 00b99e5371
Refactor fuctionals (#16)
* func - classif

* func - classif

* move checks

* formatting

* duplicates
2021-02-24 01:10:06 +00:00
Jirka Borovec f9b3820f62
Refactor utilities (#14)
* refactor utils

* isort
2021-02-24 00:16:46 +00:00
Jirka Borovec c8ee853432
add base testing (#11)
* add base testing

* move test

* ...
2021-02-23 21:05:44 +00:00
Teddy Koker 73672f92e7 rm sample module (#8)
(cherry picked from commit 4071ba78b7)
2021-02-22 10:44:25 +01:00
Jirka Borovec 62a5f4eac8 apply isort 2021-02-22 10:44:25 +01:00
Jirka Borovec fd1c11e26e flake8 2021-02-22 10:18:09 +01:00
Jirka Borovec f9553d4262 update install & tests & requirements
* update requirements

* tests

* install

* CI

(cherry picked from commit bdab86dda6)
2021-02-22 10:18:07 +01:00
Jirka Borovec 8f7c8184e2 pytorch_lighting.metrics -> torchmetrics 2021-02-22 09:59:54 +01:00
Philip E Blair 40418b52ee Fix: Allow hashing of metrics with lists in their state (PL^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>
(cherry picked from commit a1c26d36e4260543f8642a4fb581f04c5b09c04c)
2021-02-22 01:24:21 +01:00
manipopopo c998634d40 Add `dim` to `pytorch_lightning.metrics.PSNR` (PL^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>
(cherry picked from commit a3dd545b733f9b0cafbe725a4f2e57bb6bed2759)
2021-02-22 01:24:21 +01:00
Jirka Borovec 71e18a2961 fixing some compatibility with PT 1.8 (PL^5864)
* change default

* .

* p

* 0.21.2

* .

* fix

* .

(cherry picked from commit fdc1c66cdcfd07ea9a3a6e7a19d0467da1447944)
2021-02-22 01:24:21 +01:00
Jirka Borovec bfef808b77 Refactor simplify tests (PL^5861)
* add new

* restructure

* yapf

* move

* fix

(cherry picked from commit 004ddb04ee276c21ddf411d431cb8cf102c1675c)
2021-02-22 01:24:21 +01:00
Jirka Borovec a718ab3cca yapf tests metrics (PL^5845)
(cherry picked from commit cce1be3470a58aa46047d598ff00e9ad23f5f877)
2021-02-22 01:24:21 +01:00
Nicki Skafte 8bc17d8db8 Fix `num_classes` arg in F1 metric (PL^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>
(cherry picked from commit ef8efc611c12209ebf158aab7f444756ba35927e)
2021-02-22 01:24:21 +01:00
manipopopo 635d9d8b7b Fix Metric.state_dict (PL^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 c3df5122e71d497982b6764bbe51c22a26aa4fef)
(cherry picked from commit 7b0c79a7920403cc543a4a79b6efa0cca0508434)
2021-02-22 01:24:21 +01:00
yuntai 2dd5749968 Update metrics to use Enum (PL^5689)
- Add DataType, AverageMethod and MDMCAverageMethod

(cherry picked from commit 0612034ea261375c1f6f1a2396aac9caeacc55a8)
2021-02-22 01:24:20 +01:00
Nicki Skafte 855eea6ed2 AUC/AUROC class interface (PL^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>
(cherry picked from commit 86c96cdfd3a943046c2ad240d1b2e3f525e523b0)
2021-02-22 01:24:20 +01:00
Jirka Borovec 7904df201b hotfix: skip unsupported metric compostions (PL^5664)
* skip PT unsupported compositions

* flake8

(cherry picked from commit 803bd25cce5998dc6cbf66befeb204aaf6819bd9)
2021-02-22 01:24:20 +01:00
Justus Schock ff01a0b9f2 Compositional metrics (PL^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>
(cherry picked from commit a01f213bd7f4657c4444e2d8ca4244db768795cb)
2021-02-22 01:24:20 +01:00
Tadej Svetina 5cf4e45e6b Classification metrics overhaul: precision & recall (4/n) (PL^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>
(cherry picked from commit 6e3a83752e54efe2cd2fc130e95e4ee10c66e6be)
2021-02-22 01:24:20 +01:00
Arnaud Gelas bb4ad8d407 Fix pre-commit isort failure on tests/metrics/*.py (PL^5424)
* Remove tests.metrics from skipped module in pyproject.toml

* Fix pre-commit isort failure on tests/metrics/*.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
(cherry picked from commit d4ed6240c46bd012c2b8c5d0ec3eecb90cd8f86f)
2021-02-22 01:24:20 +01:00
Nicki Skafte dd1e744efe Disable default reset after compute (PL^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>
(cherry picked from commit 2dc6e588697a40d7a3ee62a35433895734d05b71)
2021-02-22 01:24:20 +01:00
deng-cy 92c2e1923b Reformat iou [func] and add IoU class (PL^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>
(cherry picked from commit 238040c9e5f2a9f03cecb171791fd8c4b88ca8b7)
2021-02-22 01:24:20 +01:00
Nicki Skafte bcb82d2a0c MetricCollection (PL^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>
(cherry picked from commit c371c57641947be0aa22ffa688d437bed6eeea82)
2021-02-22 01:24:20 +01:00
Pranjal Datta dfeaaf0713 added image-gradients (PL^4763) [1/2] (PL^5056)
* added iamge-gradients (PL^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>
(cherry picked from commit b520321c9f89aaca67f63862089dded1de300c81)
2021-02-22 01:24:20 +01:00
Tadej Svetina 20859b966e Fix metric state reset (PL^5273)
* Fix metric state reset

* Fix test

* Improve formatting

Co-authored-by: Ananya Harsh Jha <ananya@pytorchlightning.ai>
(cherry picked from commit 26488794e1af6e2fbe05bf21de52cf999252cbe7)
(cherry picked from commit c55f02a770b5fb5f6d59c48154256ef50f8fa6f1)
2021-02-22 01:24:20 +01:00