-
Notifications
You must be signed in to change notification settings - Fork 19
Re-initialise emulator before refitting in HMW #752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
@sgreenbury once we decide what the best way to handle refitting emulators is in history matching, we should look at implementing something similar in active learning too |
Yeah agreed it would it be great to not to need to have fit the Could it work adding a method to the def fit_from_reinitialized(self, x, y) -> Self:
em = TransformedEmulator(x, y, **self._init_params)
em.fit(x, y)
return emIt seems like one limitation might be that It also refocusses the API around the class ModelParamsAndEmulator:
model_class: Emulator
x_transforms: None | list[Transform]
y_transforms: None | list[Transform]
params: ModelParams
class Result:
...
def to_model_params_and_emulator(self) -> ModelParamsAndEmulator:
return ModelParamsAndEmulator(
model_class = self.model_class,
x_transforms = self.x_transforms,
y_transforms = self.y_transforms,
params = self.params,
) |
|
The one thing that we need is to store the |
Yeah agreed I like this option. One potential issue is that I think we would need to call this for each subclass's init so becomes a subclassing responsibility? Perhaps this would could be fixed by a method on the base class Emulator:
def __init__(self, x, y, **kwargs):
self._init_params = kwargs
class Subclass(Emulator):
def __init__(self, x, y, **kwargs):
...
Emulator.__init__(self, **kwargs) |
|
At the moment all subclasses are mostly defined as args with default values, is there a way to easily turn that into a class GaussianProcess
...
def __init__(self, standardize_x=True, ..., **kwargs):
gp_args = {
"standardize_x" = standardize_x,
"standardize_y" = standardize_y,
"likelihood_cls" = likelihood_cls,
"mean_module_fn" = mean_module_fn,
....
}
Emulator.__init__(**gp_args, **kwargs) |
|
I think we can do autoemulate/autoemulate/transforms/base.py Lines 73 to 99 in 5be7b7d
|
|
@sgreenbury that looks good! I'll try implementing something along those lines and then re-request a review when ready, how does that sound? |
|
Sounds great, nice one! |
Relates to #748 (to be closed once #632 is merged).
The
HistoryMatchingWorkflowobject now expects aResultrather than anEmulatorobject. I wasn't sure how else to make this work. It means that one needs to create anEmulatorthroughAutoEmulatefor them to be able to use this class (although they could also wrap it in aResultobject manually if really motivated. I don't love this limitation but we have found repeatedly that re-initialising when refitting on new data is important for overall performance.