def __call__(self,x):
     x-=self.t1
     clip_lower(x,0)
     z = (x>=self.t2)*(1.0*exp(self.e*(-self.t2))+(x-self.t2)) + \
         (x<self.t2)*(exp(self.e*(x-self.t2))-exp(self.e*(-self.t2)))
     x*=0
     x+=self.a*z
Exemple #2
0
 def __call__(self, x):
     x -= self.t1
     clip_lower(x, 0)
     z = (x>=self.t2)*(1.0*exp(self.e*(-self.t2))+(x-self.t2)) + \
         (x<self.t2)*(exp(self.e*(x-self.t2))-exp(self.e*(-self.t2)))
     x *= 0
     x += self.a * z
Exemple #3
0
    def __call__(self,x):
        if self.first_call:
            self.first_call = False
            if self.randomized_init:
                self.t = ones(x.shape, x.dtype.char) * self.t_init + \
		(topo.pattern.random.UniformRandom() \
                 (xdensity=x.shape[0],ydensity=x.shape[1])-0.5) * \
                 self.noise_magnitude*2
            else:
                self.t = ones(x.shape, x.dtype.char) * self.t_init

        x -= self.t
        clip_lower(x,0)
        x *= self.gain
    def __call__(self,x):
        if self.first_call:
            self.first_call = False
            if self.randomized_init:
                self.t = ones(x.shape, x.dtype.char) * self.t_init + \
                         (topo.pattern.random.UniformRandom() \
                          (xdensity=x.shape[0],ydensity=x.shape[1]) \
                          -0.5)*self.noise_magnitude*2
            else:
                self.t = ones(x.shape, x.dtype.char) * self.t_init
            self.y_avg = ones(x.shape, x.dtype.char) * self.target_activity

        x_orig = copy.copy(x); x -= self.t
        clip_lower(x,0);       x *= self.linear_slope

        if self.plastic: # & (float(topo.sim.time()) % 1.0 >= 0.54):
            self.y_avg = (1.0-self.smoothing)*x + self.smoothing*self.y_avg 
            self.t += self.learning_rate * (self.y_avg - self.target_activity)
    def __call__(self, x):
        if self.first_call:
            self.first_call = False
            if self.randomized_init:
                self.t = ones(x.shape, x.dtype.char) * self.t_init + (topo.pattern.random.UniformRandom(seed=123)(xdensity=x.shape[0], ydensity=x.shape[1]) - 0.5) * self.noise_magnitude * 2
            else:
                self.t = ones(x.shape, x.dtype.char) * self.t_init
            
            self.y_avg = ones(x.shape, x.dtype.char) * self.mu
        
        x_orig = copy(x)
        x -= self.t
        clip_lower(x, 0)
        x *= self.alpha

        if self.plastic & (float(topo.sim.time()) % 1.0 >= 0.54):
            self.y_avg = (1.0 - self.smoothing) * x + self.smoothing * self.y_avg 
            self.t += self.eta * (self.y_avg - self.mu)
 def __call__(self,x):
     x -= self.t
     clip_lower(x,0)
     a = power(x,self.e)
     x*=0
     x+=a
 def __call__(self,x):
     x -= self.t
     clip_lower(x,0)
     x *= x
Exemple #8
0
 def _apply_threshold(self,x):
     """Applies the piecewise-linear thresholding operation to the activity."""
     x -= self.t
     clip_lower(x,0)
     if self.linear_slope != 1.0:
         x *= self.linear_slope 
Exemple #9
0
 def __call__(self, x):
     x -= self.t
     clip_lower(x, 0)
     a = power(x, self.e)
     x *= 0
     x += a
Exemple #10
0
 def __call__(self, x):
     x -= self.t
     clip_lower(x, 0)
     x *= x