Skip to content

Commit dcaa92e

Browse files
committed
Update add_emulators tutorial with register
1 parent 893d55b commit dcaa92e

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

docs/tutorials/advanced/01_add_emulators.ipynb

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
" GaussianProcess, \n",
6868
" # the custom kernel function goes here\n",
6969
" covar_module_fn=rbs_plus_linear_kernel,\n",
70+
" auto_register=True,\n",
71+
" overwrite=True,\n",
7072
")"
7173
]
7274
},
@@ -136,8 +138,10 @@
136138
"source": [
137139
"from autoemulate.core.device import TorchDeviceMixin\n",
138140
"from autoemulate.emulators.base import PyTorchBackend\n",
141+
"from autoemulate.emulators import register\n",
139142
"import torch.nn as nn\n",
140143
"\n",
144+
"@register(overwrite=True) # decorate to register the emulator, optionally overwrite existing registration\n",
141145
"class SimpleFNN(PyTorchBackend):\n",
142146
" def __init__(\n",
143147
" self, \n",
@@ -193,6 +197,25 @@
193197
"source": [
194198
"ae.summarise()"
195199
]
200+
},
201+
{
202+
"cell_type": "markdown",
203+
"id": "12",
204+
"metadata": {},
205+
"source": [
206+
"The emulator can also be reinitialized and fitted on a dataset having been registered with AutoEmulate using the `@register` decorator."
207+
]
208+
},
209+
{
210+
"cell_type": "code",
211+
"execution_count": null,
212+
"id": "13",
213+
"metadata": {},
214+
"outputs": [],
215+
"source": [
216+
"em = ae.fit_from_reinitialized(x, y)\n",
217+
"print(em.model)"
218+
]
196219
}
197220
],
198221
"metadata": {
@@ -211,7 +234,7 @@
211234
"name": "python",
212235
"nbconvert_exporter": "python",
213236
"pygments_lexer": "ipython3",
214-
"version": "3.12.11"
237+
"version": "3.12.12"
215238
}
216239
},
217240
"nbformat": 4,

0 commit comments

Comments
 (0)