som.py
def update(self, sample):
        '''
        Updating a map.
        If the whole map has been initialized - do the regular SOM step
        else use the new sample as a prototype.
        '''
        
        sample = sample.astype('float64')
        
        if self.iteration%100==0:
            self.maps_log[str(self.iteration)]=np.copy(self.somap.reshape((self.size,self.size,self.dim)))
        
        if self.iteration < self.size**2:
            self.errors.append(0)
            self.somap[self.iteration] = sample
        else:
            self.samples.append(sample)
            self.errors.append(np.min(np.sqrt(np.sum((sample - self.somap)**2, axis=1))))
            self._update(sample)
            
        self.iteration += 1

        Updating a map.
        If the whole map has been initialized - do the regular SOM step
        else use the new sample as a prototype.
        
Updating a map.
If the whole map has been initialized - do the regular SOM step
else use the new sample as a prototype.
Updating a map . If the whole map has been initialized - do the regular SOM step else use the new sample as a prototype .
def update(self, sample):
        sample = sample.astype('float64')
        if self.iteration%100==0:
            self.maps_log[str(self.iteration)]=np.copy(self.somap.reshape((self.size,self.size,self.dim)))
        if self.iteration < self.size**2:
            self.errors.append(0)
            self.somap[self.iteration] = sample
        else:
            self.samples.append(sample)
            self.errors.append(np.min(np.sqrt(np.sum((sample - self.somap)**2, axis=1))))
            self._update(sample)
        self.iteration += 1
def update ( self , sample ) : sample = sample . astype ( 'float64' ) if self . iteration % 100 == 0 : self . maps_log [ str ( self . iteration ) ] = np . copy ( self . somap . reshape ( ( self . size , self . size , self . dim ) ) ) if self . iteration < self . size ** 2 : self . errors . append ( 0 ) self . somap [ self . iteration ] = sample else : self . samples . append ( sample ) self . errors . append ( np . min ( np . sqrt ( np . sum ( ( sample - self . somap ) ** 2 , axis = 1 ) ) ) ) self . _update ( sample ) self . iteration += 1
Updating a map.
Updating a map .
'''
        Updating a map.
        If the whole map has been initialized - do the regular SOM step
        else use the new sample as a prototype.
        '''
self
sample