Skip to content

Commit

Permalink
remove compute_on_step in torchmetrics/retrieval (#993)
Browse files Browse the repository at this point in the history
* remove compute_on_step
* update changelog
  • Loading branch information
phaseolud authored Apr 29, 2022
1 parent eb4cfaf commit f8ff34e
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 66 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed deprecated `compute_on_step` argument in Regression ([#967](https://github.com/PyTorchLightning/metrics/pull/967))


- Removed deprecated `compute_on_step` argument in Retrieval ([#993](https://github.com/PyTorchLightning/metrics/pull/993))


- Removed deprecated `compute_on_step` argument in Image ([#979](https://github.com/PyTorchLightning/metrics/pull/979))


Expand Down
6 changes: 0 additions & 6 deletions torchmetrics/retrieval/average_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ class RetrievalMAP(RetrievalMetric):
ignore_index:
Ignore predictions where the target is equal to this number.
compute_on_step:
Forward only calls ``update()`` and returns None if this is set to False.
.. deprecated:: v0.8
Argument has no use anymore and will be removed v0.9.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Raises:
Expand Down
9 changes: 1 addition & 8 deletions torchmetrics/retrieval/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ class RetrievalMetric(Metric, ABC):
ignore_index:
Ignore predictions where the target is equal to this number.
compute_on_step:
Forward only calls ``update()`` and returns None if this is set to False.
.. deprecated:: v0.8
Argument has no use anymore and will be removed v0.9.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Raises:
Expand All @@ -77,10 +71,9 @@ def __init__(
self,
empty_target_action: str = "neg",
ignore_index: Optional[int] = None,
compute_on_step: Optional[bool] = None,
**kwargs: Dict[str, Any],
) -> None:
super().__init__(compute_on_step=compute_on_step, **kwargs)
super().__init__(**kwargs)
self.allow_non_binary_target = False

empty_target_action_options = ("error", "skip", "neg", "pos")
Expand Down
8 changes: 0 additions & 8 deletions torchmetrics/retrieval/fall_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ class RetrievalFallOut(RetrievalMetric):
ignore_index:
Ignore predictions where the target is equal to this number.
k: consider only the top k elements for each query (default: `None`, which considers them all)
compute_on_step:
Forward only calls ``update()`` and returns None if this is set to False.
.. deprecated:: v0.8
Argument has no use anymore and will be removed v0.9.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Raises:
Expand Down Expand Up @@ -82,13 +76,11 @@ def __init__(
empty_target_action: str = "pos",
ignore_index: Optional[int] = None,
k: Optional[int] = None,
compute_on_step: Optional[bool] = None,
**kwargs: Dict[str, Any],
) -> None:
super().__init__(
empty_target_action=empty_target_action,
ignore_index=ignore_index,
compute_on_step=compute_on_step,
**kwargs,
)

Expand Down
8 changes: 0 additions & 8 deletions torchmetrics/retrieval/hit_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ class RetrievalHitRate(RetrievalMetric):
ignore_index:
Ignore predictions where the target is equal to this number.
k: consider only the top k elements for each query (default: ``None``, which considers them all)
compute_on_step:
Forward only calls ``update()`` and returns None if this is set to False.
.. deprecated:: v0.8
Argument has no use anymore and will be removed v0.9.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Raises:
Expand Down Expand Up @@ -80,13 +74,11 @@ def __init__(
empty_target_action: str = "neg",
ignore_index: Optional[int] = None,
k: Optional[int] = None,
compute_on_step: Optional[bool] = None,
**kwargs: Dict[str, Any],
) -> None:
super().__init__(
empty_target_action=empty_target_action,
ignore_index=ignore_index,
compute_on_step=compute_on_step,
**kwargs,
)

Expand Down
8 changes: 0 additions & 8 deletions torchmetrics/retrieval/ndcg.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ class RetrievalNormalizedDCG(RetrievalMetric):
ignore_index:
Ignore predictions where the target is equal to this number.
k: consider only the top k elements for each query (default: ``None``, which considers them all)
compute_on_step:
Forward only calls ``update()`` and returns None if this is set to False.
.. deprecated:: v0.8
Argument has no use anymore and will be removed v0.9.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Raises:
Expand Down Expand Up @@ -80,13 +74,11 @@ def __init__(
empty_target_action: str = "neg",
ignore_index: Optional[int] = None,
k: Optional[int] = None,
compute_on_step: Optional[bool] = None,
**kwargs: Dict[str, Any],
) -> None:
super().__init__(
empty_target_action=empty_target_action,
ignore_index=ignore_index,
compute_on_step=compute_on_step,
**kwargs,
)

Expand Down
8 changes: 0 additions & 8 deletions torchmetrics/retrieval/precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ class RetrievalPrecision(RetrievalMetric):
Ignore predictions where the target is equal to this number.
k: consider only the top k elements for each query (default: ``None``, which considers them all)
adaptive_k: adjust ``k`` to ``min(k, number of documents)`` for each query
compute_on_step:
Forward only calls ``update()`` and returns None if this is set to False.
.. deprecated:: v0.8
Argument has no use anymore and will be removed v0.9.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Raises:
Expand Down Expand Up @@ -84,13 +78,11 @@ def __init__(
ignore_index: Optional[int] = None,
k: Optional[int] = None,
adaptive_k: bool = False,
compute_on_step: Optional[bool] = None,
**kwargs: Dict[str, Any],
) -> None:
super().__init__(
empty_target_action=empty_target_action,
ignore_index=ignore_index,
compute_on_step=compute_on_step,
**kwargs,
)

Expand Down
6 changes: 0 additions & 6 deletions torchmetrics/retrieval/r_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ class RetrievalRPrecision(RetrievalMetric):
ignore_index:
Ignore predictions where the target is equal to this number.
compute_on_step:
Forward only calls ``update()`` and returns None if this is set to False.
.. deprecated:: v0.8
Argument has no use anymore and will be removed v0.9.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Raises:
Expand Down
8 changes: 0 additions & 8 deletions torchmetrics/retrieval/recall.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ class RetrievalRecall(RetrievalMetric):
ignore_index: Ignore predictions where the target is equal to this number.
k: consider only the top k elements for each query (default: `None`, which considers them all)
compute_on_step:
Forward only calls ``update()`` and returns None if this is set to False.
.. deprecated:: v0.8
Argument has no use anymore and will be removed v0.9.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Raises:
Expand Down Expand Up @@ -79,13 +73,11 @@ def __init__(
empty_target_action: str = "neg",
ignore_index: Optional[int] = None,
k: Optional[int] = None,
compute_on_step: Optional[bool] = None,
**kwargs: Dict[str, Any],
) -> None:
super().__init__(
empty_target_action=empty_target_action,
ignore_index=ignore_index,
compute_on_step=compute_on_step,
**kwargs,
)

Expand Down
6 changes: 0 additions & 6 deletions torchmetrics/retrieval/reciprocal_rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ class RetrievalMRR(RetrievalMetric):
- ``'error'``: raise a ``ValueError``
ignore_index: Ignore predictions where the target is equal to this number.
compute_on_step:
Forward only calls ``update()`` and returns None if this is set to False.
.. deprecated:: v0.8
Argument has no use anymore and will be removed v0.9.
kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
Raises:
Expand Down

0 comments on commit f8ff34e

Please sign in to comment.