diff --git a/catalyst/callbacks/metrics/accuracy.py b/catalyst/callbacks/metrics/accuracy.py index 418b286c78..7332b2f180 100644 --- a/catalyst/callbacks/metrics/accuracy.py +++ b/catalyst/callbacks/metrics/accuracy.py @@ -13,10 +13,7 @@ class AccuracyCallback(BatchMetricCallback): Args: input_key: input key to use for metric calculation, specifies our `y_pred` target_key: output key to use for metric calculation, specifies our `y_true` - topk_args: specifies which accuracy@K to log: - [1] - accuracy - [1, 3] - accuracy at 1 and 3 - [1, 3, 5] - accuracy at 1, 3 and 5 + topk_args: specifies which accuracy@K to log num_classes: number of classes to calculate ``topk_args`` if ``accuracy_args`` is None log_on_batch: boolean flag to log computed metrics every batch prefix: metric prefix @@ -73,6 +70,18 @@ class AccuracyCallback(BatchMetricCallback): ], ) + .. 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. diff --git a/catalyst/callbacks/metrics/cmc_score.py b/catalyst/callbacks/metrics/cmc_score.py index c6a1ec3725..7fbd15de49 100644 --- a/catalyst/callbacks/metrics/cmc_score.py +++ b/catalyst/callbacks/metrics/cmc_score.py @@ -21,10 +21,7 @@ class CMCScoreCallback(LoaderMetricCallback): embeddings_key: embeddings key in output dict labels_key: labels key in output dict is_query_key: bool key True if current object is from query - topk_args: specifies which cmc@K to log. - [1] - cmc@1 - [1, 3] - cmc@1 and cmc@3 - [1, 3, 5] - cmc@1, cmc@3 and cmc@5 + topk_args: specifies which cmc@K to log prefix: metric prefix suffix: metric suffix @@ -123,6 +120,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. diff --git a/catalyst/callbacks/metrics/recsys.py b/catalyst/callbacks/metrics/recsys.py index ce2e4903c9..c8982c3d53 100644 --- a/catalyst/callbacks/metrics/recsys.py +++ b/catalyst/callbacks/metrics/recsys.py @@ -14,10 +14,7 @@ class HitrateCallback(BatchMetricCallback): Args: input_key: input key to use for metric calculation, specifies our `y_pred` target_key: output key to use for metric calculation, specifies our `y_true` - topk_args: specifies which HR@K to log: - [1] - HR - [1, 3] - HR at 1 and 3 - [1, 3, 5] - HR at 1, 3 and 5 + topk_args: specifies which HR@K to log log_on_batch: boolean flag to log computed metrics every batch prefix: metric prefix suffix: metric suffix @@ -83,6 +80,16 @@ class HitrateCallback(BatchMetricCallback): ] ) + .. 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. @@ -115,10 +122,7 @@ class MAPCallback(BatchMetricCallback): input_key: input key to use for metric calculation, specifies our `y_pred` target_key: output key to use for metric calculation, specifies our `y_true` prefix: key for the metric's name - topk_args: specifies which MAP@K to log: - [1] - MAP - [1, 3] - MAP at 1 and 3 - [1, 3, 5] - MAP at 1, 3 and 5 + topk_args: specifies which MAP@K to log log_on_batch: boolean flag to log computed metrics every batch prefix: metric prefix suffix: metric suffix @@ -184,6 +188,16 @@ class MAPCallback(BatchMetricCallback): ] ) + .. 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. @@ -216,10 +230,7 @@ class MRRCallback(BatchMetricCallback): input_key: input key to use for metric calculation, specifies our `y_pred` target_key: output key to use for metric calculation, specifies our `y_true` prefix: key for the metric's name - topk_args: specifies which MRR@K to log: - [1] - MRR - [1, 3] - MRR at 1 and 3 - [1, 3, 5] - MRR at 1, 3 and 5 + topk_args: specifies which MRR@K to log log_on_batch: boolean flag to log computed metrics every batch prefix: metric prefix suffix: metric suffix @@ -285,6 +296,16 @@ class MRRCallback(BatchMetricCallback): ] ) + .. 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. @@ -317,10 +338,7 @@ class NDCGCallback(BatchMetricCallback): input_key: input key to use for metric calculation, specifies our `y_pred` target_key: output key to use for metric calculation, specifies our `y_true` prefix: key for the metric's name - topk_args: specifies which NDCG@K to log: - [1] - NDCG - [1, 3] - NDCG at 1 and 3 - [1, 3, 5] - NDCG at 1, 3 and 5 + topk_args: specifies which NDCG@K to log log_on_batch: boolean flag to log computed metrics every batch prefix: metric prefix suffix: metric suffix @@ -386,6 +404,16 @@ class NDCGCallback(BatchMetricCallback): ] ) + .. 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. diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index 49f634bd0b..fae4efe636 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -1,5 +1,5 @@ pytest==5.3.1 -sphinx==2.2.1 +sphinx==4.2.0 # git+https://github.com/bitprophet/releases/#egg=releases # git+https://github.com/readthedocs/sphinx_rtd_theme mock==3.0.5