From b9745dbd1846062af4fa082e27b1de579375f15e Mon Sep 17 00:00:00 2001 From: "Bryan M. Li" Date: Fri, 9 Feb 2024 15:56:31 +0000 Subject: [PATCH] initialize module and optimizer within __init__ and ignore test case where model was tested without initialization --- autoemulate/emulators/neural_net_torch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoemulate/emulators/neural_net_torch.py b/autoemulate/emulators/neural_net_torch.py index a6b8608e..1a4296ce 100644 --- a/autoemulate/emulators/neural_net_torch.py +++ b/autoemulate/emulators/neural_net_torch.py @@ -91,6 +91,8 @@ def __init__( verbose=verbose, **kwargs, ) + self._initialize_module() + self._initialize_optimizer() def set_params(self, **params): if "random_state" in params: @@ -128,6 +130,7 @@ def _more_tags(self): "check_parameters_default_constructible": "skorch NeuralNet class callbacks parameter expects a list of callables.", "check_dont_overwrite_parameters": "the change of public attribute module__input_size is needed to support dynamic input size.", "check_estimators_overwrite_params": "module parameters changes upon fitting the estimator hence produce non-identical result.", + "check_estimators_unfitted": "NeuralNetTorch does not support prediction without initializing the module.", }, }