|
157 | 157 | "showInput": false |
158 | 158 | }, |
159 | 159 | "source": [ |
160 | | - "### Instantiate a `BoTorchModel` in Ax\n", |
| 160 | + "### Instantiate a `BoTorchGenerator` in Ax\n", |
161 | 161 | "\n", |
162 | | - "A `BoTorchModel` in Ax encapsulates both the surrogate -- which `Ax` calls a `Surrogate` and BoTorch calls a `Model` -- and an acquisition function. Here, we will only specify the custom surrogate and let Ax choose the default acquisition function.\n", |
| 162 | + "A `BoTorchGenerator` in Ax encapsulates both the surrogate -- which `Ax` calls a `Surrogate` and BoTorch calls a `Model` -- and an acquisition function. Here, we will only specify the custom surrogate and let Ax choose the default acquisition function.\n", |
163 | 163 | "\n", |
164 | | - "Most models should work with the base `Surrogate` in Ax, except for BoTorch `ModelListGP`, which works with `ListSurrogate`.\n", |
165 | 164 | "Note that the `Model` (e.g., the `SimpleCustomGP`) must implement `construct_inputs`, as this is used to construct the inputs required for instantiating a `Model` instance from the experiment data." |
166 | 165 | ] |
167 | 166 | }, |
|
188 | 187 | }, |
189 | 188 | "outputs": [], |
190 | 189 | "source": [ |
191 | | - "from ax.models.torch.botorch_modular.model import BoTorchModel\n", |
| 190 | + "from ax.models.torch.botorch_modular.model import BoTorchGenerator\n", |
192 | 191 | "from ax.models.torch.botorch_modular.surrogate import Surrogate, SurrogateSpec\n", |
193 | 192 | "from ax.models.torch.botorch_modular.utils import ModelConfig\n", |
194 | 193 | "\n", |
195 | | - "ax_model = BoTorchModel(\n", |
| 194 | + "ax_model = BoTorchGenerator(\n", |
196 | 195 | " surrogate=Surrogate(\n", |
197 | 196 | " surrogate_spec=SurrogateSpec(\n", |
198 | 197 | " model_configs=[\n", |
|
230 | 229 | "source": [ |
231 | 230 | "### Combine with a `ModelBridge`\n", |
232 | 231 | "\n", |
233 | | - "`Model`s in Ax require a `ModelBridge` to interface with `Experiment`s. A `ModelBridge` takes the inputs supplied by the `Experiment` and converts them to the inputs expected by the `Model`. For a `BoTorchModel`, we use `TorchModelBridge`. The Modular BoTorch interface creates the `BoTorchModel` and the `TorchModelBridge` in a single step, as follows:\n", |
| 232 | + "`Model`s in Ax require a `ModelBridge` to interface with `Experiment`s. A `ModelBridge` takes the inputs supplied by the `Experiment` and converts them to the inputs expected by the `Model`. For a `BoTorchGenerator`, we use `TorchModelBridge`. The Modular BoTorch interface creates the `BoTorchGenerator` and the `TorchModelBridge` in a single step, as follows:\n", |
234 | 233 | "\n", |
235 | 234 | "```\n", |
236 | | - "from ax.modelbridge.registry import Models\n", |
237 | | - "model_bridge = Models.BOTORCH_MODULAR(\n", |
| 235 | + "from ax.modelbridge.registry import Generators\n", |
| 236 | + "model_bridge = Generators.BOTORCH_MODULAR(\n", |
238 | 237 | " experiment=experiment,\n", |
239 | 238 | " data=data,\n", |
240 | 239 | " surrogate=Surrogate(SimpleCustomGP),\n", |
|
308 | 307 | "outputs": [], |
309 | 308 | "source": [ |
310 | 309 | "from ax.modelbridge.generation_strategy import GenerationStep, GenerationStrategy\n", |
311 | | - "from ax.modelbridge.registry import Models\n", |
| 310 | + "from ax.modelbridge.registry import Generators\n", |
312 | 311 | "\n", |
313 | 312 | "\n", |
314 | 313 | "gs = GenerationStrategy(\n", |
315 | 314 | " steps=[\n", |
316 | 315 | " # Quasi-random initialization step\n", |
317 | 316 | " GenerationStep(\n", |
318 | | - " model=Models.SOBOL,\n", |
| 317 | + " model=Generators.SOBOL,\n", |
319 | 318 | " num_trials=5, # How many trials should be produced from this generation step\n", |
320 | 319 | " ),\n", |
321 | 320 | " # Bayesian optimization step using the custom acquisition function\n", |
322 | 321 | " GenerationStep(\n", |
323 | | - " model=Models.BOTORCH_MODULAR,\n", |
| 322 | + " model=Generators.BOTORCH_MODULAR,\n", |
324 | 323 | " num_trials=-1, # No limitation on how many trials should be produced from this step\n", |
325 | 324 | " # For `BOTORCH_MODULAR`, we pass in kwargs to specify what surrogate or acquisition function to use.\n", |
326 | 325 | " model_kwargs={\n", |
|
1809 | 1808 | }, |
1810 | 1809 | "outputs": [], |
1811 | 1810 | "source": [ |
1812 | | - "from ax.modelbridge.registry import Models\n", |
| 1811 | + "from ax.modelbridge.registry import Generators\n", |
1813 | 1812 | "\n", |
1814 | 1813 | "\n", |
1815 | | - "sobol = Models.SOBOL(exp.search_space)\n", |
| 1814 | + "sobol = Generators.SOBOL(exp.search_space)\n", |
1816 | 1815 | "\n", |
1817 | 1816 | "for i in range(5):\n", |
1818 | 1817 | " trial = exp.new_trial(generator_run=sobol.gen(1))\n", |
|
1878 | 1877 | "source": [ |
1879 | 1878 | "with fast_smoke_test():\n", |
1880 | 1879 | " for i in range(NUM_EVALS - 5):\n", |
1881 | | - " model_bridge = Models.BOTORCH_MODULAR(\n", |
| 1880 | + " model_bridge = Generators.BOTORCH_MODULAR(\n", |
1882 | 1881 | " experiment=exp,\n", |
1883 | 1882 | " data=exp.fetch_data(),\n", |
1884 | 1883 | " surrogate_spec=SurrogateSpec(\n", |
|
0 commit comments