NIPY logo

Site Navigation

NIPY Community

Table Of Contents

Previous topic

neurospin.clustering.bootstrap_hc

Next topic

neurospin.clustering.ggmixture

This Page

neurospin.clustering.clustering

Module: neurospin.clustering.clustering

Functions

nipy.neurospin.clustering.clustering.kmeans(X, nbclusters=2, Labels=None, maxiter=300, delta=0.0001, verbose=0, ninit=1)

kmeans clustering algorithm

Parameters :

X: array of shape (n,p): n = number of items, p = dimension :

data array

nbclusters (int), the number of desired clusters :

Labels = None array of shape (n) prior Labels. :

if None or inadequate a random initilization is performed.

maxiter=300 (int), the maximum number of iterations before convergence :

delta=0.0001 (float), :

the relative increment in the results before declaring convergence.

verbose=0: verbosity mode :

ninit=1: number of random initalizations :

Returns :

Centers: array of size nbclusters*p, :

the centroids of the resulting clusters

Labels : array of size n, the discrete labels of the input items

J (float): the final value of the inertia criterion :

nipy.neurospin.clustering.clustering.tempTest()
nipy.neurospin.clustering.clustering.voronoi(x, centers)

Assignment of data items to nearest cluster center

Parameters :

x array of shape (n,p) :

n = number of items, p = data dimension

centers, array of shape (k,p) the cluster centers :

Returns :

z vector of shape(n), the resulting assignment :