Skip to content

Commit 98c7fd1

Browse files
esantorellameta-codesync[bot]
authored andcommitted
Remove generated_points argument to RandomGenerator (#5186)
Summary: Pull Request resolved: #5186 **Context**: This was deprecated in Ax 1.0.0 and has not done anything since then. **This PR**: * Removes `generated_points` argument to `RandomGenerator` * Removes places where this is passed (which would have been recursively triggering the warning) Reviewed By: saitcakmak Differential Revision: D101824526 fbshipit-source-id: 61d44c0efc37a2443f0cf7afacd78a3ede48c1cc
1 parent ffd1057 commit 98c7fd1

8 files changed

Lines changed: 5 additions & 32 deletions

File tree

ax/adapter/tests/test_registry.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ def test_view_defaults(self) -> None:
177177
"deduplicate": True,
178178
"init_position": 0,
179179
"scramble": True,
180-
"generated_points": None,
181180
"fallback_to_sample_polytope": False,
182181
"polytope_sampler_kwargs": None,
183182
},

ax/generation_strategy/tests/test_generation_strategy.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ def test_sobol_MBM_strategy(self) -> None:
673673
"scramble": True,
674674
"fallback_to_sample_polytope": False,
675675
"polytope_sampler_kwargs": None,
676-
"generated_points": None,
677676
},
678677
)
679678
self.assertEqual(
@@ -1631,7 +1630,6 @@ def test_gs_with_generation_nodes(self) -> None:
16311630
"scramble": True,
16321631
"fallback_to_sample_polytope": False,
16331632
"polytope_sampler_kwargs": None,
1634-
"generated_points": None,
16351633
},
16361634
)
16371635
self.assertEqual(

ax/generators/random/base.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
# pyre-strict
88

9-
import warnings
109
from collections.abc import Callable
1110
from logging import Logger
1211
from typing import Any
@@ -57,9 +56,6 @@ class RandomGenerator(Generator):
5756
of samples to fast-forward before generating new samples.
5857
Used to ensure that the re-loaded generator will continue generating
5958
from the same sequence rather than starting from scratch.
60-
generated_points: A set of previously generated points to use
61-
for deduplication. These should be provided in the raw transformed
62-
space the model operates in.
6359
fallback_to_sample_polytope: If True, when rejection sampling fails,
6460
we fall back to the HitAndRunPolytopeSampler.
6561
"""
@@ -69,7 +65,6 @@ def __init__(
6965
deduplicate: bool = True,
7066
seed: int | None = None,
7167
init_position: int = 0,
72-
generated_points: npt.NDArray | None = None,
7368
fallback_to_sample_polytope: bool = False,
7469
polytope_sampler_kwargs: dict[str, Any] | None = None,
7570
) -> None:
@@ -86,15 +81,6 @@ def __init__(
8681
self.polytope_sampler_kwargs: dict[str, Any] = polytope_sampler_kwargs or {}
8782
self._bounds: npt.NDArray = np.empty((0, 2))
8883
self.attempted_draws: int = 0
89-
if generated_points is not None:
90-
# generated_points was deprecated in Ax 1.0.0, so it can now be reaped.
91-
warnings.warn(
92-
"The `generated_points` argument is deprecated and will be removed "
93-
"in a future version of Ax. It is being ignored in favor of "
94-
"extracting the generated points directly from the experiment.",
95-
DeprecationWarning,
96-
stacklevel=2,
97-
)
9884

9985
@property
10086
def can_predict(self) -> bool:

ax/generators/random/sobol.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ def __init__(
3838
seed: int | None = None,
3939
init_position: int = 0,
4040
scramble: bool = True,
41-
generated_points: npt.NDArray | None = None,
4241
fallback_to_sample_polytope: bool = False,
4342
polytope_sampler_kwargs: dict[str, Any] | None = None,
4443
) -> None:
4544
super().__init__(
4645
deduplicate=deduplicate,
4746
seed=seed,
4847
init_position=init_position,
49-
generated_points=generated_points,
5048
fallback_to_sample_polytope=fallback_to_sample_polytope,
5149
polytope_sampler_kwargs=polytope_sampler_kwargs,
5250
)

ax/generators/random/uniform.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ def __init__(
2626
deduplicate: bool = True,
2727
seed: int | None = None,
2828
init_position: int = 0,
29-
generated_points: npt.NDArray | None = None,
3029
fallback_to_sample_polytope: bool = False,
3130
) -> None:
3231
super().__init__(
3332
deduplicate=deduplicate,
3433
seed=seed,
3534
init_position=init_position,
36-
generated_points=generated_points,
3735
fallback_to_sample_polytope=fallback_to_sample_polytope,
3836
)
3937
self._rs = np.random.RandomState(seed=self.seed)

ax/storage/json_store/decoder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def _raise_on_legacy_callable_refs(kwarg_dict: dict[str, Any]) -> dict[str, Any]
140140
"torch_dtype",
141141
"status_quo_name",
142142
"status_quo_features",
143+
"generated_points",
143144
)
144145

145146
# Deprecated node input constructors, removed from GNodes.

ax/storage/json_store/tests/test_json_store.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,7 @@ def test_generator_run_backwards_compatibility(self) -> None:
12611261
"deduplicate": False,
12621262
"seed": None,
12631263
"torch_dtype": None,
1264+
"generated_points": None,
12641265
},
12651266
"bridge_kwargs": {
12661267
"transforms": {},

ax/storage/sqa_store/tests/test_sqa_store.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -833,13 +833,13 @@ def test_experiment_save_and_load_reduced_state(
833833
# 3. Try case with model state and search space + opt.config on a
834834
# generator run in the experiment.
835835
gr = Generators.SOBOL(experiment=exp).gen(1)
836-
# Expecting model kwargs to have 7 fields (seed, deduplicate, init_position,
837-
# scramble, generated_points, fallback_to_sample_polytope,
836+
# Expecting model kwargs to have 6 fields (seed, deduplicate, init_position,
837+
# scramble, fallback_to_sample_polytope,
838838
# polytope_sampler_kwargs)
839839
# and the rest of model-state info on generator run to have values too.
840840
generator_kwargs = gr._generator_kwargs
841841
self.assertIsNotNone(generator_kwargs)
842-
self.assertEqual(len(generator_kwargs), 7)
842+
self.assertEqual(len(generator_kwargs), 6)
843843
adapter_kwargs = gr._adapter_kwargs
844844
self.assertIsNotNone(adapter_kwargs)
845845
self.assertEqual(len(adapter_kwargs), 6)
@@ -1896,8 +1896,6 @@ def test_parameter_constraint_validation(self) -> None:
18961896
sqa_parameter_constraint = SQAParameterConstraint(
18971897
bound=Decimal(0),
18981898
constraint_dict={},
1899-
# pyre-fixme[6]: For 3rd param expected `IntEnum` but got
1900-
# `ParameterConstraintType`.
19011899
type=ParameterConstraintType.LINEAR,
19021900
)
19031901
with self.assertRaises(ValueError):
@@ -1915,8 +1913,6 @@ def test_parameter_constraint_validation(self) -> None:
19151913
sqa_parameter_constraint = SQAParameterConstraint(
19161914
bound=Decimal(0),
19171915
constraint_dict={},
1918-
# pyre-fixme[6]: For 3rd param expected `IntEnum` but got
1919-
# `ParameterConstraintType`.
19201916
type=ParameterConstraintType.LINEAR,
19211917
generator_run_id=0,
19221918
)
@@ -1929,8 +1925,6 @@ def test_parameter_constraint_validation(self) -> None:
19291925

19301926
def test_decode_order_parameter_constraint_failure(self) -> None:
19311927
sqa_parameter = SQAParameterConstraint(
1932-
# pyre-fixme[6]: For 1st param expected `IntEnum` but got
1933-
# `ParameterConstraintType`.
19341928
type=ParameterConstraintType.ORDER,
19351929
constraint_dict={},
19361930
bound=Decimal(0),
@@ -1942,8 +1936,6 @@ def test_decode_order_parameter_constraint_failure(self) -> None:
19421936

19431937
def test_decode_sum_parameter_constraint_failure(self) -> None:
19441938
sqa_parameter = SQAParameterConstraint(
1945-
# pyre-fixme[6]: For 1st param expected `IntEnum` but got
1946-
# `ParameterConstraintType`.
19471939
type=ParameterConstraintType.SUM,
19481940
constraint_dict={},
19491941
bound=Decimal(0),

0 commit comments

Comments
 (0)