Skip to content

Commit

Permalink
Remove FixedNoiseDataset (pytorch#2626)
Browse files Browse the repository at this point in the history
Summary:

This was deprecated and marked for removal in v0.11.

Reviewed By: esantorella

Differential Revision: D66003588
  • Loading branch information
saitcakmak authored and facebook-github-bot committed Nov 15, 2024
1 parent 92d73e4 commit 741dbec
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 47 deletions.
34 changes: 0 additions & 34 deletions botorch/utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from __future__ import annotations

import warnings
from typing import Any

import torch
Expand Down Expand Up @@ -149,39 +148,6 @@ def __eq__(self, other: Any) -> bool:
)


class FixedNoiseDataset(SupervisedDataset):
r"""A SupervisedDataset with an additional field `Yvar` that stipulates
observations variances so that `Y[i] ~ N(f(X[i]), Yvar[i])`.
NOTE: This is deprecated. Use `SupervisedDataset` instead.
Will be removed in a future release (~v0.11).
"""

def __init__(
self,
X: BotorchContainer | Tensor,
Y: BotorchContainer | Tensor,
Yvar: BotorchContainer | Tensor,
feature_names: list[str],
outcome_names: list[str],
validate_init: bool = True,
) -> None:
r"""Initialize a `FixedNoiseDataset` -- deprecated!"""
warnings.warn(
"`FixedNoiseDataset` is deprecated. Use `SupervisedDataset` instead.",
DeprecationWarning,
stacklevel=2,
)
super().__init__(
X=X,
Y=Y,
feature_names=feature_names,
outcome_names=outcome_names,
Yvar=Yvar,
validate_init=validate_init,
)


class RankingDataset(SupervisedDataset):
r"""A SupervisedDataset whose labelled pairs `(x, y)` consist of m-ary combinations
`x ∈ Z^{m}` of elements from a ground set `Z = (z_1, ...)` and ranking vectors
Expand Down
14 changes: 1 addition & 13 deletions test/utils/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from botorch.utils.containers import DenseContainer, SliceContainer
from botorch.utils.datasets import (
ContextualDataset,
FixedNoiseDataset,
MultiTaskDataset,
RankingDataset,
SupervisedDataset,
Expand Down Expand Up @@ -129,7 +128,7 @@ def test_fixedNoise(self):
Yvar = rand(3, 1)
feature_names = ["x1", "x2"]
outcome_names = ["y"]
dataset = FixedNoiseDataset(
dataset = SupervisedDataset(
X=X,
Y=Y,
Yvar=Yvar,
Expand All @@ -142,17 +141,6 @@ def test_fixedNoise(self):
self.assertEqual(dataset.feature_names, feature_names)
self.assertEqual(dataset.outcome_names, outcome_names)

with self.assertRaisesRegex(
ValueError, "`Y` and `Yvar`"
), self.assertWarnsRegex(DeprecationWarning, "SupervisedDataset"):
FixedNoiseDataset(
X=X,
Y=Y,
Yvar=Yvar.squeeze(),
feature_names=feature_names,
outcome_names=outcome_names,
)

def test_ranking(self):
# Test `_validate`
X_val = rand(16, 2)
Expand Down

0 comments on commit 741dbec

Please sign in to comment.