2

I am new with clustering and neural nets, and I have just started using Self-Organizing Maps (SOM) to perform some clustering. I have a 15 dimensional dataset and I created a som with the next code:

size = 20
from minisom import MiniSom    
som = MiniSom(size, size, 15, sigma=0.3, learning_rate=0.9, random_seed=149)
som.train_random(data, 650000, verbose=True)

And I plotted the som the next way:

plt.figure()
plt.pcolor(som.distance_map().T, cmap='Blues')
plt.colorbar()

plt.show()

My question is: if I have a new 15 dimensional element, how can I know which cluster of the som belongs to?

jartymcfly
  • 1,945
  • 9
  • 30
  • 51

2 Answers2

1

Best Matching Unit (BMU)

for t in itertools.count():
        i =  np.random.choice(range(len(data)))
        bmu = self.find_bmu(data[i])

Finding the Best Matching Unit

create n x n map with random node vector values

loop while s < StepsMax times

compute what a "close" node means, based on s

compute a learn rate, based on s

pick a random data item

determine the map node closest to data item (BMU)

for-each node close to the BMU

adjust node vector values towards data item

end-loop

SOM - BMU

Community
  • 1
  • 1
Mahsa Hassankashi
  • 2,086
  • 1
  • 15
  • 25
1

I have a feeling that MiniSom has a function implemented for this:

som.winner(*input_data*)

which returns the node that it is closest to.

William Herewini
  • 199
  • 2
  • 16