Ejemplo n.º 1
0
    def sqgrad(self, input, target):
        """
        Returns gradient of network error vs. network weights.

        Error is calculated for **normalized** input and target arrays.

        :Parameters:
            input : 2-D array
                Array of input patterns
            target : 2-D array
                Array of network targets

        :Returns:
            grad : 1-D array
                Array of the same length as *net.weights* containing
                gradient values.

        .. note::
            This function might be slow in frequent use, because data
            normalization is performed at each call. Usually there's no need
            to use this function, unless you need to adopt your own training
            strategy.
        """
        input, target = self._setnorm(input, target)
        g  = netprop.grad(self.weights, self.conec, self.bconecno, self.units, \
                          self.inno, self.outno, input, target)
        return g
Ejemplo n.º 2
0
 def sqgrad(self, input, target):
     """
     Returns gradient of sqerror vs. network weights.
     Input and target arrays are first normalized.
     Might be slow in frequent use, because data normalization is
     performed at each call.
     """
     input, target = self._setnorm(input, target) 
     g  = netprop.grad(self.weights, self.conec, self.bconecno, self.units, \
                       self.inno, self.outno, input, target)
     return g
Ejemplo n.º 3
0
 def sqgrad(self, input, target):
     """
     Returns gradient of sqerror vs. network weights.
     Input and target arrays are first normalized.
     Might be slow in frequent use, because data normalization is
     performed at each call.
     """
     input, target = self._setnorm(input, target)
     g  = netprop.grad(self.weights, self.conec, self.bconecno, self.units, \
                       self.inno, self.outno, input, target)
     return g
Ejemplo n.º 4
0
 def sqgrad(self, input, target):
     """
     Returns gradient of sqerror vs. network weights.
     Input and target arrays are first normalized.
     Might be slow in frequent use, because data normalization is
     performed at each call.
     
     Warning:
     _setnorm should be called before sqgrad - will be changed in future.
     """
     input, target = self._testdata(input, target) 
     input = _normarray(input, self.eni) #Normalization data might be uninitialized here!
     target = _normarray(target, self.eno)
     g  = netprop.grad(self.weights, self.conec, self.bconecno, self.units, \
                       self.inno, self.outno, input, target)
     return g
Ejemplo n.º 5
0
 def sqgrad(self, input, target):
     """
     Returns gradient of sqerror vs. network weights.
     Input and target arrays are first normalized.
     Might be slow in frequent use, because data normalization is
     performed at each call.
     
     Warning:
     _setnorm should be called before sqgrad - will be changed in future.
     """
     input, target = self._testdata(input, target)
     input = _normarray(
         input, self.eni)  #Normalization data might be uninitialized here!
     target = _normarray(target, self.eno)
     g  = netprop.grad(self.weights, self.conec, self.bconecno, self.units, \
                       self.inno, self.outno, input, target)
     return g