Open bryanlimy opened 4 months ago
Currently, MODEL_REGISTER is a dictionary of emulators where all the emulators would be initialized when we call _get_models.
MODEL_REGISTER
_get_models
MODEL_REGISTRY = { "SecondOrderPolynomial": SecondOrderPolynomial(), "RBF": RBF(), "RandomForest": RandomForest(), "GradientBoosting": GradientBoosting(), "GaussianProcessSk": GaussianProcessSk(), "SupportVectorMachines": SupportVectorMachines(), "XGBoost": XGBoost(), "NeuralNetSk": NeuralNetSk(), "NeuralNetTorch": NeuralNetTorch(module="mlp"), # "GaussianProcess": GaussianProcess,
Since MODEL_REGISTER is a dictionary, it caches the initialized module and would return initialized module instead of returning a new instance of the module when we call get_models again. This would lead to unexpected errors (i.e. shape mismatch).
get_models
As a hotfix https://github.com/alan-turing-institute/autoemulate/pull/180/commits/3db7e7e509e29b6072607a204e6f1d115e20a6f0, we added deepcopy in _get_models upon initialization, but a proper model register that return an instance of a module is needed.
deepcopy
Currently,
MODEL_REGISTER
is a dictionary of emulators where all the emulators would be initialized when we call_get_models
.Since
MODEL_REGISTER
is a dictionary, it caches the initialized module and would return initialized module instead of returning a new instance of the module when we callget_models
again. This would lead to unexpected errors (i.e. shape mismatch).As a hotfix https://github.com/alan-turing-institute/autoemulate/pull/180/commits/3db7e7e509e29b6072607a204e6f1d115e20a6f0, we added
deepcopy
in_get_models
upon initialization, but a proper model register that return an instance of a module is needed.