MCPcopy Create free account
hub / github.com/ddbourgin/numpy-ml / set_params

Method set_params

numpy_ml/neural_nets/optimizers/optimizers.py:37–51  ·  view source on GitHub ↗

Set the parameters of the optimizer object from a dictionary

(self, hparam_dict=None, cache_dict=None)

Source from the content-addressed store, hash-verified

35 return deepcopy(self)
36
37 def set_params(self, hparam_dict=None, cache_dict=None):
38 """Set the parameters of the optimizer object from a dictionary"""
39 from ..initializers import SchedulerInitializer
40
41 if hparam_dict is not None:
42 for k, v in hparam_dict.items():
43 if k in self.hyperparameters:
44 self.hyperparameters[k] = v
45 if k == "lr_scheduler":
46 self.lr_scheduler = SchedulerInitializer(v, lr=None)()
47
48 if cache_dict is not None:
49 for k, v in cache_dict.items():
50 if k in self.cache:
51 self.cache[k] = v
52
53 @abstractmethod
54 def update(self, param, param_grad, param_name, cur_loss=None):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected