Best way to test clustering algorithm

What is the best way to test the clustering algorithm? I use an agglomeration clustering algorithm with stopping criteria. How to check the correct formation of clusters or not?

+3
source share
4 answers

It depends on what you want to test.

When testing your own implementation of a well-known algorithm, you may need to compare the results with the results of a well-known good implementation.

, . , Rand .., . , , .

+2

, ( ), " ". A, ( ). , - , .

( numpy python), , ( c ). , ( ) :

from numpy import *
import pylab as plt

# Make a block diagonal matrix
N = 30
c = 5
A = zeros((N*c,N*c))
for m in xrange(c):
    A[m*N:(m+1)*N, m*N:(m+1)*N] = random.random((N,N))

# Add some noise
A += random.random(A.shape) * 0.1

# Make symmetric
A += A.T - diag(A.diagonal())

# Show the original matrix
plt.subplot(131)
plt.imshow(A.copy(), interpolation='nearest')

# Permute the matrix for effect
idx = random.permutation(N*c)
A = A[idx,:][:,idx]

# Compute eigenvalues
L = linalg.eigvalsh(A)

# Show the results
plt.subplot(132)
plt.imshow(A, interpolation='nearest')
plt.subplot(133)
plt.plot(sorted(L,reverse=True))

plt.plot([c-.5,c-.5],[0,max(L)],'r--')

plt.ylim(0,max(L))
plt.xlim(0,20)
plt.show() 

enter image description here

+4

- ( ) . , , .

, .

+1

, , , . N , . , 2- , , , , , , .

, , - .

+1

All Articles