I have a similarity matrix between four users. I want to do an agglomerative clustering. the code is like this:
lena = np.matrix('1 1 0 0;1 1 0 0;0 0 1 0.2;0 0 0.2 1')
X = np.reshape(lena, (-1, 1))
print("Compute structured hierarchical clustering...")
st = time.time()
n_clusters = 3 # number of regionsle
ward = AgglomerativeClustering(n_clusters=n_clusters,
linkage='complete').fit(X)
print ward
label = np.reshape(ward.labels_, lena.shape)
print("Elapsed time: ", time.time() - st)
print("Number of pixels: ", label.size)
print("Number of clusters: ", np.unique(label).size)
print label
the print result of label is like:
[[1 1 0 0]
[1 1 0 0]
[0 0 1 2]
[0 0 2 1]]
Does this mean it gives a lists of possible cluster result, we can choose one from them? like choosing: [0,0,2,1]. If is wrong, could you tell me how to do the agglomerative algorithm based on similarity? If it'ss right, the similarity matrix is huge, how can i choose the optimal clustering result from a huge list? Thanks