Skip to content

Commit

Permalink
Add note section to topk metrics docs (#1334)
Browse files Browse the repository at this point in the history
* Add note section to topk metrics docs

* Fix codestyle
  • Loading branch information
sergunya17 committed Oct 25, 2021
1 parent f63fed3 commit c528795
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 1 deletion.
12 changes: 12 additions & 0 deletions catalyst/metrics/_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ class AccuracyMetric(TopKMetric):
],
)
.. note::
Metric names depending on input parameters:
- ``topk_args = None`` ---> see \
:py:mod:`catalyst.metrics.functional._misc.get_default_topk_args`
- ``topk_args = (1,)`` ---> ``"accuracy01"``
- ``topk_args = (1, 3)`` ---> ``"accuracy01"``, ``"accuracy03"``
- ``topk_args = (1, 3, 5)`` ---> ``"accuracy01"``, ``"accuracy03"``, ``"accuracy05"``
You can find them in ``runner.batch_metrics``, ``runner.loader_metrics`` or
``runner.epoch_metrics``.
.. note::
Please follow the `minimal examples`_ sections for more use cases.
Expand Down
10 changes: 10 additions & 0 deletions catalyst/metrics/_cmc_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ def handle_batch(self, batch) -> None:
num_epochs=10,
)
.. note::
Metric names depending on input parameters:
- ``topk_args = (1,) or None`` ---> ``"cmc01"``
- ``topk_args = (1, 3)`` ---> ``"cmc01"``, ``"cmc03"``
- ``topk_args = (1, 3, 5)`` ---> ``"cmc01"``, ``"cmc03"``, ``"cmc05"``
You can find them in ``runner.batch_metrics``, ``runner.loader_metrics`` or
``runner.epoch_metrics``.
.. note::
Please follow the `minimal examples`_ sections for more use cases.
Expand Down
10 changes: 10 additions & 0 deletions catalyst/metrics/_hitrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ class HitrateMetric(TopKMetric):
]
)
.. note::
Metric names depending on input parameters:
- ``topk_args = (1,) or None`` ---> ``"hitrate01"``
- ``topk_args = (1, 3)`` ---> ``"hitrate01"``, ``"hitrate03"``
- ``topk_args = (1, 3, 5)`` ---> ``"hitrate01"``, ``"hitrate03"``, ``"hitrate05"``
You can find them in ``runner.batch_metrics``, ``runner.loader_metrics`` or
``runner.epoch_metrics``.
.. note::
Please follow the `minimal examples`_ sections for more use cases.
Expand Down
10 changes: 10 additions & 0 deletions catalyst/metrics/_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ class MAPMetric(TopKMetric):
]
)
.. note::
Metric names depending on input parameters:
- ``topk_args = (1,) or None`` ---> ``"map01"``
- ``topk_args = (1, 3)`` ---> ``"map01"``, ``"map03"``
- ``topk_args = (1, 3, 5)`` ---> ``"map01"``, ``"map03"``, ``"map05"``
You can find them in ``runner.batch_metrics``, ``runner.loader_metrics`` or
``runner.epoch_metrics``.
.. note::
Please follow the `minimal examples`_ sections for more use cases.
Expand Down
10 changes: 10 additions & 0 deletions catalyst/metrics/_mrr.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ class MRRMetric(TopKMetric):
]
)
.. note::
Metric names depending on input parameters:
- ``topk_args = (1,) or None`` ---> ``"mrr01"``
- ``topk_args = (1, 3)`` ---> ``"mrr01"``, ``"mrr03"``
- ``topk_args = (1, 3, 5)`` ---> ``"mrr01"``, ``"mrr03"``, ``"mrr05"``
You can find them in ``runner.batch_metrics``, ``runner.loader_metrics`` or
``runner.epoch_metrics``.
.. note::
Please follow the `minimal examples`_ sections for more use cases.
Expand Down
10 changes: 10 additions & 0 deletions catalyst/metrics/_ndcg.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ class NDCGMetric(TopKMetric):
]
)
.. note::
Metric names depending on input parameters:
- ``topk_args = (1,) or None`` ---> ``"ndcg01"``
- ``topk_args = (1, 3)`` ---> ``"ndcg01"``, ``"ndcg03"``
- ``topk_args = (1, 3, 5)`` ---> ``"ndcg01"``, ``"ndcg03"``, ``"ndcg05"``
You can find them in ``runner.batch_metrics``, ``runner.loader_metrics`` or
``runner.epoch_metrics``.
.. note::
Please follow the `minimal examples`_ sections for more use cases.
Expand Down
2 changes: 1 addition & 1 deletion catalyst/metrics/functional/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def get_multilabel_statistics(


def get_default_topk_args(num_classes: int) -> Sequence[int]:
"""Calculate list params for ``Accuracy@k`` and ``mAP@k``.
"""Calculate list params for ``Accuracy@k``.
Args:
num_classes: number of classes
Expand Down

0 comments on commit c528795

Please sign in to comment.