som.py
def _update(self, sample):
        '''
        the update of the SOM - main part
        finding the closest prototype
        update of the whole map
        '''
        
        error = np.argmin(np.sum((sample - self.somap)**2, axis=1))
        p_vec = self.q_lookup(error)
        for q in range(self.size**2):
            q_vec = self.q_lookup(q)
            temp_diff = (sample - self.somap[q]) # this accounts for the distance in the samples space
            temp_h =  self.h_vec(q_vec, p_vec)             # this accounts for the distance in the map space
            update = self.eta * temp_h * temp_diff
            self.somap[q] += update.astype('float64')
        self.sigma *= 0.9997
        self.eta *= 0.9997

        the update of the SOM - main part
        finding the closest prototype
        update of the whole map
        
the update of the SOM - main part
finding the closest prototype
update of the whole map
the update of the SOM - main part finding the closest prototype update of the whole map
def _update(self, sample):
        error = np.argmin(np.sum((sample - self.somap)**2, axis=1))
        p_vec = self.q_lookup(error)
        for q in range(self.size**2):
            q_vec = self.q_lookup(q)
            temp_diff = (sample - self.somap[q]) 
            temp_h =  self.h_vec(q_vec, p_vec)             
            update = self.eta * temp_h * temp_diff
            self.somap[q] += update.astype('float64')
        self.sigma *= 0.9997
        self.eta *= 0.9997
def _update ( self , sample ) : error = np . argmin ( np . sum ( ( sample - self . somap ) ** 2 , axis = 1 ) ) p_vec = self . q_lookup ( error ) for q in range ( self . size ** 2 ) : q_vec = self . q_lookup ( q ) temp_diff = ( sample - self . somap [ q ] ) temp_h = self . h_vec ( q_vec , p_vec ) update = self . eta * temp_h * temp_diff self . somap [ q ] += update . astype ( 'float64' ) self . sigma *= 0.9997 self . eta *= 0.9997
the update of the SOM - main part
finding the closest prototype
update of the whole map
the update of the SOM - main part finding the closest prototype update of the whole map
'''
        the update of the SOM - main part
        finding the closest prototype
        update of the whole map
        ''' # this accounts for the distance in the samples space # this accounts for the distance in the map space
self
sample