In [1]:
import sys
sys.path.append('.')
sys.path.append('../')
import generatedatasets
import SOM2
import SOMclust
from pylab import *
pylab.rcParams['figure.figsize'] = 10, 10 # that's default image size for this interactive session
In [2]:
xy, c = generatedatasets.dataset_fixed_cov()
In [3]:
scatter(*xy.T, c=c)
Out[3]:
In [4]:
xy.shape
Out[4]:
In [5]:
som = SOM2.SOM(xy)
In [6]:
smap = som.learn(verbose=True)
In [7]:
umat = som.umatrix()
In [8]:
matshow(umat)
colorbar()
Out[8]:
In [9]:
bmus = som.get_allbmus()
In [10]:
clust = SOMclust.clusters(umat, bmus, som.smap)
In [11]:
imshow(ma.masked_array(clust.umat_cont, clust.mask), interpolation='nearest')
Out[11]: