Example #1
0
    def __call__(self, net, input, target):

        if not self.adapt:
            while True:
                g, output = self.calc(net, input, target)
                # regularization grad
                if self.rr > 0:
                    g = tool.reg_grad(g, net, self.rr)
                e = self.error(net, input, target, output)
                # regularization error
                if self.rr:
                    e = tool.reg_error(e, net, self.rr)
                self.epochf(e, net, input, target)
                self.learn(net, g)
        else:
            while True:
                for i in range(input.shape[0]):
                    g = self.calc(net, [input[i]], [target[i]])[0]
                    # regularization grad
                    if self.rr > 0:
                        g = tool.reg_grad(g, net, self.rr)
                    self.learn(net, g)
                e = self.error(net, input, target)
                # regularization error
                if self.rr:
                    e = tool.reg_error(e, self.rr, net)
                self.epochf(e, net, input, target)
        return None
Example #2
0
 def fcn(self, x):
     self.x[:] = x
     err = self.error(self.net, self.input, self.target)
     if self.rr:
         eee = tool.reg_error(err, self.net, self.rr)
     self.lerr = err
     return err
Example #3
0
 def fcn(self, x):
     self.x[:] = x
     err = self.error(self.net, self.input, self.target)
     if self.rr:
         eee = tool.reg_error(err, self.net, self.rr)
     self.lerr = err
     return err