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 2/n #1143

Merged
merged 90 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
90 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
db6a01a
class interface
SkafteNicki Jun 21, 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
ffcdc25
Merge branch 'devel/classification' into refactor/classification_2
SkafteNicki Jun 30, 2022
98ff28b
Merge branch 'refactor/classification_1' into refactor/classification_2
SkafteNicki Jun 30, 2022
debaa91
docs
SkafteNicki Jun 30, 2022
5b36988
inits
SkafteNicki Jun 30, 2022
bedf208
merge
SkafteNicki Jul 13, 2022
141eb02
fix
SkafteNicki Jul 13, 2022
00c18e6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2022
d04d985
fix mistakes
SkafteNicki Jul 13, 2022
c290353
working cohen kappa
SkafteNicki Jul 13, 2022
ff09d27
merge
SkafteNicki Jul 13, 2022
97acff4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2022
4d3f1d6
Delete speed.py
SkafteNicki Jul 13, 2022
57e32c4
cohen kappa done
SkafteNicki Jul 13, 2022
5a75458
working matthews
SkafteNicki Jul 13, 2022
d505858
merge
SkafteNicki Jul 13, 2022
7a98b33
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 13, 2022
f819601
working jaccard
SkafteNicki Jul 14, 2022
2e7e746
Merge branch 'refactor/classification_2' of https://github.com/PyTorc…
SkafteNicki Jul 14, 2022
558cb68
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2022
d0abe80
docstrings for jaccard
SkafteNicki Jul 14, 2022
43a5616
small improve
SkafteNicki Jul 14, 2022
3e814a0
typing
SkafteNicki Jul 14, 2022
59162f7
fix doctest
SkafteNicki Jul 14, 2022
4c7de22
try something
SkafteNicki Jul 15, 2022
2f02092
Apply suggestions from code review
Borda Jul 15, 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
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.BinaryCohenKappa
:noindex:
:exclude-members: update, compute

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

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

Functional Interface
____________________

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

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

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

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

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

.. autofunction:: torchmetrics.functional.multiclass_cohen_kappa
:noindex:
46 changes: 46 additions & 0 deletions docs/source/classification/jaccard_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,57 @@ Jaccard Index
Module Interface
________________

CohenKappa
^^^^^^^^^^

.. autoclass:: torchmetrics.JaccardIndex
:noindex:

BinaryJaccardIndex
^^^^^^^^^^^^^^^^^^

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

MulticlassJaccardIndex
^^^^^^^^^^^^^^^^^^^^^^

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

MultilabelJaccardIndex
^^^^^^^^^^^^^^^^^^^^^^

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


Functional Interface
____________________

jaccard_index
^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.jaccard_index
:noindex:

binary_jaccard_index
SkafteNicki marked this conversation as resolved.
Show resolved Hide resolved
^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.binary_jaccard_index
:noindex:

multiclass_jaccard_index
^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.multiclass_jaccard_index
:noindex:

multilabel_jaccard_index
^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.multilabel_jaccard_index
:noindex:
52 changes: 49 additions & 3 deletions docs/source/classification/matthews_corr_coef.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,64 @@

.. include:: ../links.rst

####################
Matthews Corr. Coef.
####################
################################
Matthews Correlation Coefficient
################################

Module Interface
________________

MatthewsCorrCoef
^^^^^^^^^^^^^^^^

.. autoclass:: torchmetrics.MatthewsCorrCoef
:noindex:

BinaryMatthewsCorrCoef
^^^^^^^^^^^^^^^^^^^^^^

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

MulticlassMatthewsCorrCoef
^^^^^^^^^^^^^^^^^^^^^^^^^^

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

MultilabelMatthewsCorrCoef
^^^^^^^^^^^^^^^^^^^^^^^^^^

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


Functional Interface
____________________

matthews_corrcoef
^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.matthews_corrcoef
:noindex:

binary_matthews_corrcoef
^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.binary_matthews_corrcoef
:noindex:

multiclass_matthews_corrcoef
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.multiclass_matthews_corrcoef
:noindex:

multilabel_matthews_corrcoef
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autofunction:: torchmetrics.functional.multilabel_matthews_corrcoef
:noindex:
16 changes: 16 additions & 0 deletions src/torchmetrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
ROC,
Accuracy,
AveragePrecision,
BinaryCohenKappa,
BinaryConfusionMatrix,
BinaryJaccardIndex,
BinaryMatthewsCorrCoef,
BinaryStatScores,
BinnedAveragePrecision,
BinnedPrecisionRecallCurve,
Expand All @@ -45,9 +48,14 @@
LabelRankingAveragePrecision,
LabelRankingLoss,
MatthewsCorrCoef,
MulticlassCohenKappa,
MulticlassConfusionMatrix,
MulticlassJaccardIndex,
MulticlassMatthewsCorrCoef,
MulticlassStatScores,
MultilabelConfusionMatrix,
MultilabelJaccardIndex,
MultilabelMatthewsCorrCoef,
MultilabelStatScores,
Precision,
PrecisionRecallCurve,
Expand Down Expand Up @@ -131,6 +139,8 @@
"CharErrorRate",
"CHRFScore",
"CohenKappa",
"BinaryCohenKappa",
"MulticlassCohenKappa",
"ConfusionMatrix",
"BinaryConfusionMatrix",
"MulticlassConfusionMatrix",
Expand All @@ -147,11 +157,17 @@
"HammingDistance",
"HingeLoss",
"JaccardIndex",
"BinaryJaccardIndex",
"MulticlassJaccardIndex",
"MultilabelJaccardIndex",
"KLDivergence",
"LabelRankingAveragePrecision",
"LabelRankingLoss",
"MatchErrorRate",
"MatthewsCorrCoef",
"BinaryMatthewsCorrCoef",
"MulticlassMatthewsCorrCoef",
"MultilabelMatthewsCorrCoef",
"MaxMetric",
"MeanAbsoluteError",
"MeanAbsolutePercentageError",
Expand Down
41 changes: 26 additions & 15 deletions src/torchmetrics/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from torchmetrics.classification.confusion_matrix import ( # noqa: F401 isort:skip
BinaryConfusionMatrix,
ConfusionMatrix,
MulticlassConfusionMatrix,
MultilabelConfusionMatrix,
)
from torchmetrics.classification.stat_scores import ( # noqa: F401 isort:skip
BinaryStatScores,
MulticlassStatScores,
MultilabelStatScores,
StatScores,
)

from torchmetrics.classification.accuracy import Accuracy # noqa: F401
from torchmetrics.classification.auc import AUC # noqa: F401
from torchmetrics.classification.auroc import AUROC # noqa: F401
Expand All @@ -19,20 +32,24 @@
from torchmetrics.classification.binned_precision_recall import BinnedPrecisionRecallCurve # noqa: F401
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 ( # noqa: F401
BinaryConfusionMatrix,
ConfusionMatrix,
MulticlassConfusionMatrix,
MultilabelConfusionMatrix,
)
from torchmetrics.classification.cohen_kappa import BinaryCohenKappa, CohenKappa, MulticlassCohenKappa # noqa: F401
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
from torchmetrics.classification.hinge import HingeLoss # noqa: F401
from torchmetrics.classification.jaccard import JaccardIndex # noqa: F401
from torchmetrics.classification.jaccard import ( # noqa: F401
BinaryJaccardIndex,
JaccardIndex,
MulticlassJaccardIndex,
MultilabelJaccardIndex,
)
from torchmetrics.classification.kl_divergence import KLDivergence # noqa: F401
from torchmetrics.classification.matthews_corrcoef import MatthewsCorrCoef # noqa: F401
from torchmetrics.classification.matthews_corrcoef import ( # noqa: F401
BinaryMatthewsCorrCoef,
MatthewsCorrCoef,
MulticlassMatthewsCorrCoef,
MultilabelMatthewsCorrCoef,
)
from torchmetrics.classification.precision_recall import Precision, Recall # noqa: F401
from torchmetrics.classification.precision_recall_curve import PrecisionRecallCurve # noqa: F401
from torchmetrics.classification.ranking import ( # noqa: F401
Expand All @@ -42,9 +59,3 @@
)
from torchmetrics.classification.roc import ROC # noqa: F401
from torchmetrics.classification.specificity import Specificity # noqa: F401
from torchmetrics.classification.stat_scores import ( # noqa: F401
BinaryStatScores,
MulticlassStatScores,
MultilabelStatScores,
StatScores,
)
Loading