The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

432318 (1) [Avatar] Offline
#1
Hello Guys
Let me ask one question about SOM algorithm in page 108.(v9_MEAP)

Code Listing 5.12 somehow shows just color matrix.

colors = np.array(
[[0., 0., 1.],
[0., 0., 0.95],
[0., 0.05, 1.],
[0., 1., 0.],
[0., 0.95, 0.],
[0., 1, 0.05],
[1., 0., 0.],
[1., 0.05, 0.],
[1., 0., 0.05],
[1., 1., 0.]])

som = SOM(4, 4, 3)
som.train(colors)

plt.imshow(som.centroid_grid)
plt.show()


However, how can I check which X(input data) are clustered ?
for example, colors(X input data) indices 1,4,5 are in same cluster, ... 2,3 are in same.. and so on

Thanks in advance.