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

Classification Refactor [rebase & merge] #1195

Merged
merged 18 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .azure/gpu-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
agents: 'azure-jirka-spot'
#maxParallel: '2'
# how long to run the job before automatically cancelling
timeoutInMinutes: "55"
timeoutInMinutes: "65"
# how much time to give 'run always even if cancelled tasks' before stopping them
cancelTimeoutInMinutes: "2"

Expand Down
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
4 changes: 3 additions & 1 deletion .github/workflows/ci_test-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ jobs:
python ./.github/assistant.py prune-packages requirements/detection.txt torchvision
# import of PILLOW_VERSION which they recently removed in v9.0 in favor of __version__
pip install -q "Pillow<9.0" # It messes with torchvision
pip install -e . -r requirements/devel.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html
pip install -e . -r requirements/devel.txt "torch==${{ matrix.pytorch-version }}.*" -f $TORCH_URL
pip list
python -c "from torch import __version__ as ver; assert '.'.join(ver.split('.')[:2]) == '${{ matrix.pytorch-version }}', ver"
env:
TORCH_URL: https://download.pytorch.org/whl/cpu/torch_stable.html

- name: DocTests
working-directory: ./src
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/code-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: Code formatting

# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: [master, "release/*"]
push: {}
pull_request:
branches: [master, "release/*"]

Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ 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),
[#1143](https://github.com/Lightning-AI/metrics/pull/1143),
[#1145](https://github.com/Lightning-AI/metrics/pull/1145),
[#1151](https://github.com/Lightning-AI/metrics/pull/1151),
[#1159](https://github.com/Lightning-AI/metrics/pull/1159),
[#1163](https://github.com/Lightning-AI/metrics/pull/1163),
[#1167](https://github.com/Lightning-AI/metrics/pull/1167),
[#1175](https://github.com/Lightning-AI/metrics/pull/1175),
[#1189](https://github.com/Lightning-AI/metrics/pull/1189),
[#1197](https://github.com/Lightning-AI/metrics/pull/1197),
[#1215](https://github.com/Lightning-AI/metrics/pull/1215),
[#1195](https://github.com/Lightning-AI/metrics/pull/1195)
)

- Changed update in `FID` metric to be done in a online fashion to save memory ([#1199](https://github.com/PyTorchLightning/metrics/pull/1199))


Expand Down
38 changes: 37 additions & 1 deletion docs/source/classification/accuracy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,44 @@ ________________
.. autoclass:: torchmetrics.Accuracy
:noindex:

BinaryAccuracy
^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.BinaryAccuracy
:noindex:

MulticlassAccuracy
^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MulticlassAccuracy
:noindex:

MultilabelAccuracy
^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MultilabelAccuracy
:noindex:

Functional Interface
____________________

.. autofunction:: torchmetrics.functional.accuracy
.. autofunction:: torchmetrics.functional.classification.accuracy
:noindex:

binary_accuracy
^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.binary_accuracy
:noindex:

multiclass_accuracy
^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multiclass_accuracy
:noindex:

multilabel_accuracy
^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multilabel_accuracy
:noindex:
36 changes: 36 additions & 0 deletions docs/source/classification/auroc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,44 @@ ________________
.. autoclass:: torchmetrics.AUROC
:noindex:

BinaryAUROC
^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.BinaryAUROC
:noindex:

MulticlassAUROC
^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MulticlassAUROC
:noindex:

MultilabelAUROC
^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MultilabelAUROC
:noindex:

Functional Interface
____________________

.. autofunction:: torchmetrics.functional.auroc
:noindex:

binary_auroc
^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.binary_auroc
:noindex:

multiclass_auroc
^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multiclass_auroc
:noindex:

multilabel_auroc
^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multilabel_auroc
:noindex:
36 changes: 36 additions & 0 deletions docs/source/classification/average_precision.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,44 @@ ________________
.. autoclass:: torchmetrics.AveragePrecision
:noindex:

BinaryAveragePrecision
^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.BinaryAveragePrecision
:noindex:

MulticlassAveragePrecision
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MulticlassAveragePrecision
:noindex:

MultilabelAveragePrecision
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MultilabelAveragePrecision
:noindex:

Functional Interface
____________________

.. autofunction:: torchmetrics.functional.average_precision
:noindex:

binary_average_precision
^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.binary_average_precision
:noindex:

multiclass_average_precision
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multiclass_average_precision
:noindex:

multilabel_average_precision
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multilabel_average_precision
:noindex:
24 changes: 24 additions & 0 deletions docs/source/classification/calibration_error.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,32 @@ ________________
.. autoclass:: torchmetrics.CalibrationError
:noindex:

BinaryCalibrationError
^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.BinaryCalibrationError
:noindex:

MulticlassCalibrationError
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MulticlassCalibrationError
:noindex:

Functional Interface
____________________

.. autofunction:: torchmetrics.functional.calibration_error
:noindex:

binary_calibration_error
^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.binary_calibration_error
:noindex:

multiclass_calibration_error
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multiclass_calibration_error
:noindex:
32 changes: 32 additions & 0 deletions docs/source/classification/cohen_kappa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,43 @@ Cohen Kappa
Module Interface
________________

CohenKappa
^^^^^^^^^^

.. autoclass:: torchmetrics.CohenKappa
:noindex:

BinaryCohenKappa
^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.BinaryCohenKappa
:noindex:
:exclude-members: update, compute

MulticlassCohenKappa
^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MulticlassCohenKappa
:noindex:
:exclude-members: update, compute

Functional Interface
____________________

cohen_kappa
^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.cohen_kappa
:noindex:

binary_cohen_kappa
^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.binary_cohen_kappa
:noindex:

multiclass_cohen_kappa
^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multiclass_cohen_kappa
:noindex:
42 changes: 42 additions & 0 deletions docs/source/classification/confusion_matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,53 @@ Confusion Matrix
Module Interface
________________

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

.. autoclass:: torchmetrics.ConfusionMatrix
:noindex:

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

.. autoclass:: torchmetrics.classification.BinaryConfusionMatrix
:noindex:

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

.. autoclass:: torchmetrics.classification.MulticlassConfusionMatrix
:noindex:

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

.. autoclass:: torchmetrics.classification.MultilabelConfusionMatrix
:noindex:

Functional Interface
____________________

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

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

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

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

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

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

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

.. autofunction:: torchmetrics.functional.classification.multilabel_confusion_matrix
:noindex:
6 changes: 6 additions & 0 deletions docs/source/classification/coverage_error.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ ________________
.. autoclass:: torchmetrics.CoverageError
:noindex:

.. autoclass:: torchmetrics.classification.MultilabelCoverageError
:noindex:

Functional Interface
____________________

.. autofunction:: torchmetrics.functional.coverage_error
:noindex:

.. autofunction:: torchmetrics.functional.classification.multilabel_coverage_error
:noindex:
26 changes: 26 additions & 0 deletions docs/source/classification/exact_match.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.. customcarditem::
:header: Exact Match
:image: https://pl-flash-data.s3.amazonaws.com/assets/thumbnails/tabular_classification.svg
:tags: Classification

###########
Exact Match
###########

Module Interface
________________

MultilabelExactMatch
^^^^^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.classification.MultilabelExactMatch
:noindex:

Functional Interface
____________________

multilabel_exact_match
^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.classification.multilabel_exact_match
:noindex:
Loading