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

[Refactor] Classification 1/n #1054

Merged
merged 76 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
7c79801
base structure
SkafteNicki May 27, 2022
121b9fa
bincount
SkafteNicki May 27, 2022
1074281
binary
SkafteNicki May 27, 2022
4f4dad6
files
SkafteNicki May 28, 2022
e58c9a5
stat score
SkafteNicki May 28, 2022
0ba326f
multiclass + multilabel confmat
SkafteNicki May 30, 2022
85471c4
update
SkafteNicki May 30, 2022
336d277
stat_score
SkafteNicki May 31, 2022
b9fdf6c
change bincount
SkafteNicki Jun 2, 2022
e83c30a
move back
SkafteNicki Jun 2, 2022
b32000f
del tests
SkafteNicki Jun 2, 2022
6d5ee70
rest of structure
SkafteNicki Jun 2, 2022
dee14cf
confmat working
SkafteNicki Jun 3, 2022
b9bd9dc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 3, 2022
f1c664d
working binary stat scores
SkafteNicki Jun 5, 2022
c824c52
Merge branch 'refactor/classification_1' of https://github.com/PyTorc…
SkafteNicki Jun 5, 2022
a21fc0f
full testing
SkafteNicki Jun 6, 2022
f11c1e7
update
SkafteNicki Jun 7, 2022
5a1495c
update
SkafteNicki Jun 8, 2022
f82d807
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 8, 2022
c4cfef3
add missing tests
SkafteNicki Jun 10, 2022
166772e
Merge branch 'refactor/classification_1' of https://github.com/PyTorc…
SkafteNicki Jun 10, 2022
fe0c12d
update
SkafteNicki Jun 13, 2022
5185139
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 13, 2022
9de5dde
merge master
SkafteNicki Jun 13, 2022
45e5fd1
Merge branch 'refactor/classification_1' of https://github.com/PyTorc…
SkafteNicki Jun 13, 2022
9bd7e76
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 13, 2022
cb5eabf
multilabel stat scores
SkafteNicki Jun 14, 2022
77a1afe
merge
SkafteNicki Jun 14, 2022
44df555
disable old testing
SkafteNicki Jun 14, 2022
5ba6ef3
more testing
SkafteNicki Jun 14, 2022
5baec90
flaky tests
SkafteNicki Jun 15, 2022
12fed05
changelog
SkafteNicki Jun 20, 2022
fa3adc0
refactor
SkafteNicki Jun 20, 2022
7efdfc7
Merge branch 'devel/classification' into refactor/classification_1
SkafteNicki Jun 20, 2022
13c059d
Merge branch 'devel/classification' into refactor/classification_1
SkafteNicki Jun 21, 2022
55d52f6
fixes
SkafteNicki Jun 21, 2022
196953c
typing
SkafteNicki Jun 21, 2022
c76b204
update
SkafteNicki Jun 21, 2022
f0e5d16
fix tests
SkafteNicki Jun 21, 2022
3e5e8db
Apply suggestions from code review
SkafteNicki Jun 28, 2022
887ee26
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 28, 2022
2096dd4
Apply suggestions from code review
SkafteNicki Jun 28, 2022
58dc23a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 28, 2022
c8d82d3
Apply suggestions from code review
SkafteNicki Jun 28, 2022
f2d870c
Update src/torchmetrics/functional/classification/confusion_matrix.py
SkafteNicki Jun 28, 2022
8dec6e4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 28, 2022
3f0e3e8
Merge branch 'devel/classification' into refactor/classification_1
SkafteNicki Jun 28, 2022
6c39518
missing literal
SkafteNicki Jun 28, 2022
05db489
add docstring to functional confusion matrix
SkafteNicki Jun 29, 2022
ae9ca58
add docstring to modular confusion matrix
SkafteNicki Jun 29, 2022
afcde9c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 29, 2022
24bc7f9
add docstring to functional stat scores
SkafteNicki Jun 29, 2022
75e2f23
Merge branch 'refactor/classification_1' of https://github.com/PyTorc…
SkafteNicki Jun 29, 2022
3116c4a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 29, 2022
6f0320a
add docstring to modular stat scores
SkafteNicki Jun 29, 2022
4738421
Merge branch 'refactor/classification_1' of https://github.com/PyTorc…
SkafteNicki Jun 29, 2022
1e26154
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 29, 2022
fd2325e
make private
SkafteNicki Jun 30, 2022
f8d18dc
docs
SkafteNicki Jun 30, 2022
40b813f
fix mypy and doctests
SkafteNicki Jun 30, 2022
f79a889
fix docs formatting
SkafteNicki Jun 30, 2022
6f5ed75
literal backwards
SkafteNicki Jun 30, 2022
6e98c7f
custom movedim
SkafteNicki Jun 30, 2022
97d847e
debug
SkafteNicki Jul 11, 2022
7b32294
Merge branch 'devel/classification' into refactor/classification_1
SkafteNicki Jul 11, 2022
376e97b
debug
SkafteNicki Jul 11, 2022
ea52dca
fix tests
SkafteNicki Jul 11, 2022
b3b0229
Merge branch 'refactor/classification_1' of https://github.com/PyTorc…
SkafteNicki Jul 11, 2022
cc94664
fix tests
SkafteNicki Jul 11, 2022
1732ce6
fix tests
SkafteNicki Jul 12, 2022
be6a8c0
fix tests
SkafteNicki Jul 12, 2022
8f049b1
add some testing
SkafteNicki Jul 12, 2022
4657c5a
fix tests
SkafteNicki Jul 12, 2022
e8993a0
fix docstring
Borda Jul 12, 2022
fee0dc4
fix tests
SkafteNicki Jul 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/unittesting/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ runs:

- name: Unittests
working-directory: ./tests
run: python -m pytest ${{ inputs.dirs }} --cov=torchmetrics --junitxml="$PYTEST_ARTEFACT.xml" --durations=50 ${{ inputs.test-timeout }}
run: python -m pytest -v --maxfail=5 ${{ inputs.dirs }} --cov=torchmetrics --junitxml="$PYTEST_ARTEFACT.xml" --durations=50 ${{ inputs.test-timeout }}
shell: ${{ inputs.shell-type }}

- name: Upload pytest results
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

-
- Classification refactor (
[#1054](https://github.com/Lightning-AI/metrics/pull/1054),
)


-

Expand Down
45 changes: 45 additions & 0 deletions docs/source/classification/confusion_matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,56 @@ Confusion Matrix
Module Interface
________________

ConfusionMatrix
^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.ConfusionMatrix
:noindex:

BinaryConfusionMatrix
^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.BinaryConfusionMatrix
:noindex:
:exclude-members: update, compute

MulticlassConfusionMatrix
^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.MulticlassConfusionMatrix
:noindex:
:exclude-members: update, compute

MultilabelConfusionMatrix
^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.MultilabelConfusionMatrix
:noindex:
:exclude-members: update, compute

Functional Interface
____________________

confusion_matrix
^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.confusion_matrix
:noindex:

binary_confusion_matrix
^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.binary_confusion_matrix
:noindex:

multiclass_confusion_matrix
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.multiclass_confusion_matrix
:noindex:

multilabel_confusion_matrix
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.multilabel_confusion_matrix
:noindex:
45 changes: 45 additions & 0 deletions docs/source/classification/stat_scores.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,56 @@ Stat Scores
Module Interface
________________

StatScores
^^^^^^^^^^

.. autoclass:: torchmetrics.StatScores
:noindex:

BinaryStatScores
^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.BinaryStatScores
:noindex:
:exclude-members: update, compute

MulticlassStatScores
^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.MulticlassStatScores
:noindex:
:exclude-members: update, compute

MultilabelStatScores
^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.MultilabelStatScores
:noindex:
:exclude-members: update, compute

Functional Interface
____________________

stat_scores
^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.stat_scores
:noindex:

binary_stat_scores
^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.binary_stat_scores
:noindex:

multiclass_stat_scores
^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.multiclass_stat_scores
:noindex:

multilabel_stat_scores
^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.multilabel_stat_scores
:noindex:
12 changes: 12 additions & 0 deletions src/torchmetrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
ROC,
Accuracy,
AveragePrecision,
BinaryConfusionMatrix,
BinaryStatScores,
BinnedAveragePrecision,
BinnedPrecisionRecallCurve,
BinnedRecallAtFixedPrecision,
Expand All @@ -43,6 +45,10 @@
LabelRankingAveragePrecision,
LabelRankingLoss,
MatthewsCorrCoef,
MulticlassConfusionMatrix,
MulticlassStatScores,
MultilabelConfusionMatrix,
MultilabelStatScores,
Precision,
PrecisionRecallCurve,
Recall,
Expand Down Expand Up @@ -126,6 +132,9 @@
"CHRFScore",
"CohenKappa",
"ConfusionMatrix",
"BinaryConfusionMatrix",
"MulticlassConfusionMatrix",
"MultilabelConfusionMatrix",
"CosineSimilarity",
"CoverageError",
"Dice",
Expand Down Expand Up @@ -187,6 +196,9 @@
"SQuAD",
"StructuralSimilarityIndexMeasure",
"StatScores",
"BinaryStatScores",
"MulticlassStatScores",
"MultilabelStatScores",
"SumMetric",
"SymmetricMeanAbsolutePercentageError",
"TranslationEditRate",
Expand Down
14 changes: 12 additions & 2 deletions src/torchmetrics/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
from torchmetrics.classification.binned_precision_recall import BinnedRecallAtFixedPrecision # noqa: F401
from torchmetrics.classification.calibration_error import CalibrationError # noqa: F401
from torchmetrics.classification.cohen_kappa import CohenKappa # noqa: F401
from torchmetrics.classification.confusion_matrix import ConfusionMatrix # noqa: F401
from torchmetrics.classification.confusion_matrix import ( # noqa: F401
BinaryConfusionMatrix,
ConfusionMatrix,
MulticlassConfusionMatrix,
MultilabelConfusionMatrix,
)
from torchmetrics.classification.dice import Dice # noqa: F401
from torchmetrics.classification.f_beta import F1Score, FBetaScore # noqa: F401
from torchmetrics.classification.hamming import HammingDistance # noqa: F401
Expand All @@ -37,4 +42,9 @@
)
from torchmetrics.classification.roc import ROC # noqa: F401
from torchmetrics.classification.specificity import Specificity # noqa: F401
from torchmetrics.classification.stat_scores import StatScores # noqa: F401
from torchmetrics.classification.stat_scores import ( # noqa: F401
BinaryStatScores,
MulticlassStatScores,
MultilabelStatScores,
StatScores,
)
Loading