Exemplo n.º 1
0
 def _instance_initialize(self, obj, input_size = None, target_size = None,
                          seed = 1827, **init):
     # obj is an "instance" of this module holding values for each member and
     # functions for each method
     if input_size and target_size:
         # initialize w and b in a special way using input_size and target_size
         sz = (input_size, target_size)
         rng = N.random.RandomState(seed)
         obj.w = rng.uniform(size = sz, low = -0.5, high = 0.5)
         obj.b = N.zeros(target_size)
         obj.stepsize = 0.01
     # here we call the default_initialize method, which takes all the name: value
     # pairs in init and sets the property with that name to the provided value
     # this covers setting stepsize, l2_coef; w and b can be set that way too
     # we call it after as we want the parameter to superseed the default value.
     M.default_initialize(obj,**init)
Exemplo n.º 2
0
 def _instance_initialize(self, obj, input_size = None, target_size = None,
                          seed = 1827, **init):
     # obj is an "instance" of this module holding values for each member and
     # functions for each method
     if input_size and target_size:
         # initialize w and b in a special way using input_size and target_size
         sz = (input_size, target_size)
         rng = N.random.RandomState(seed)
         obj.w = rng.uniform(size = sz, low = -0.5, high = 0.5)
         obj.b = N.zeros(target_size)
         obj.stepsize = 0.01
     # here we call the default_initialize method, which takes all the name: value
     # pairs in init and sets the property with that name to the provided value
     # this covers setting stepsize, l2_coef; w and b can be set that way too
     # we call it after as we want the parameter to superseed the default value.
     M.default_initialize(obj,**init)