Functions
contrib/brl/bseg/sdet/sdet_k_means.h File Reference

K Means clustering functions. More...

#include <vcl_vector.h>
#include <vnl/vnl_vector.h>

Go to the source code of this file.

Functions

unsigned sdet_k_means (vcl_vector< vnl_vector< double > > &data, unsigned &k, vcl_vector< vnl_vector< double > > *cluster_centres, vcl_vector< unsigned > *partition=0)
 Find k cluster centres.
unsigned sdet_k_means_weighted (vcl_vector< vnl_vector< double > > &data, unsigned &k, const vcl_vector< double > &wts, vcl_vector< vnl_vector< double > > *cluster_centres, vcl_vector< unsigned > *partition=0)
 Find k cluster centres with weighted data.

Detailed Description

K Means clustering functions.

Author:
Ian Scott
Date:
18-May-2001
   Copied to sdet to avoid cross linking, J.L. Mundy December 13, 2011
   

Definition in file sdet_k_means.h.


Function Documentation

unsigned sdet_k_means ( vcl_vector< vnl_vector< double > > &  data,
unsigned &  k,
vcl_vector< vnl_vector< double > > *  cluster_centres,
vcl_vector< unsigned > *  partition 
)

Find k cluster centres.

Uses batch k-means clustering. If you provide parameter partition, it will return the cluster index for each data sample. The number of iterations performed is returned.

Initial Cluster Centres
If centres contain the correct number of centres, they will be used as the initial centres, If not, and if partition is given, and it is the correct size, then this will be used to find the initial centres.
Degenerate Cases
If at any point the one of the centres has no data points allocated to it the number of centres will be reduced below k. This is most likely to happen if you start the function with one or more centre identical, or if some of the centres start off outside the convex hull of the data set. In particular if you let the function initialise the centres, it will occur if any of the first k data samples are identical.

Definition at line 30 of file sdet_k_means.cxx.

unsigned sdet_k_means_weighted ( vcl_vector< vnl_vector< double > > &  data,
unsigned &  k,
const vcl_vector< double > &  wts,
vcl_vector< vnl_vector< double > > *  cluster_centres,
vcl_vector< unsigned > *  partition 
)

Find k cluster centres with weighted data.

Uses batch k-means clustering. If you provide parameter partition, it will return the cluster index for each data sample. The number of iterations performed is returned.

Initial Cluster Centres
If centres contain the correct number of centres, they will be used as the initial centres, If not, and if partition is given, and it is the correct size, then this will be used to find the initial centres.
Degenerate Cases
If at any point the one of the centres has no data points allocated to it the number of centres will be reduced below k. This is most likely to happen if you start the function with one or more centre identical, or if some of the centres start off outside the convex hull of the data set. In particular if you let the function initialise the centres, it will occur if any of the first k data samples are identical.

Uses batch k-means clustering. If you provide parameter partition, it will return the cluster index for each data sample. The number of iterations performed is returned.

Initial Cluster Centres
If centres contain the correct number of centres, they will be used as the initial centres, If not, and if partition is given, and it is the correct size, then this will be used to find the initial centres.
Degenerate Cases
If at any point the one of the centres has no data points allocated to it the number of centres will be reduced below k. This is most likely to happen if you start the function with one or more centre identical, or if some of the centres start off outside the convex hull of the data set. In particular if you let the function initialise the centres, it will occur if any of the first k data samples are identical.
The algorithm has been optimised

Definition at line 200 of file sdet_k_means.cxx.