Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

fl::KMeans Class Reference

#include <cluster.h>

Inheritance diagram for fl::KMeans:

fl::ClusterMethod fl::KMeansParallel List of all members.

Public Methods

 KMeans (float maxSize, float minSize, int initialK, int maxK, const std::string &clusterFileName="")
 clusterFileName refers to target file for new clustering data, which is very likely to be different from input file.

 KMeans (std::istream &stream, const std::string &clusterFileName="")
 Construct from stream.

virtual void run (const std::vector< Vector< float > > &data)
 Peform clustering on collection of points.

virtual int classify (const Vector< float > &point)
 Determine the single best class of given point.

virtual Vector< float > distribution (const Vector< float > &point)
 Return a probability distribution over the classes. Row number in the returned Vector corresponds to class number.

virtual int classCount ()
 Returns the number of classes.

virtual Vector< float > representative (int group)
 Return a representative member of group. "group" has same semantics as return value of classify (); we just can't use the word "class" because it is a keyword in C++. :).

virtual void read (std::istream &stream)
virtual void write (std::ostream &stream, bool withName=false)
void initialize (const std::vector< Vector< float > > &data)
void estimate (const std::vector< Vector< float > > &data, Matrix< float > &member, int jbegin, int jend)
float maximize (const std::vector< Vector< float > > &data, const Matrix< float > &member, int i)
bool convergence (const std::vector< Vector< float > > &data, const Matrix< float > &member, float largestChange)

Public Attributes

float maxSize
 Largest length of dominant axis of covariance matrix. If any cluster exceeds this value, create a new cluster.

float minSize
 Closest that two clusters can be before they merge.

int initialK
 Lower bound on expected number of clusters.

int maxK
 Largest number of clusters allowed.

std::vector< ClusterGaussclusters
std::vector< float > changes
std::vector< float > velocities
std::string clusterFileName
time_t clusterFileTime
 Time in seconds.

off_t clusterFileSize

Constructor & Destructor Documentation

KMeans::KMeans float    maxSize,
float    minSize,
int    initialK,
int    maxK,
const std::string &    clusterFileName = ""
 

clusterFileName refers to target file for new clustering data, which is very likely to be different from input file.

KMeans::KMeans std::istream &    stream,
const std::string &    clusterFileName = ""
 

Construct from stream.


Member Function Documentation

int KMeans::classCount   [virtual]
 

Returns the number of classes.

Implements fl::ClusterMethod.

int KMeans::classify const Vector< float > &    point [virtual]
 

Determine the single best class of given point.

Implements fl::ClusterMethod.

bool KMeans::convergence const std::vector< Vector< float > > &    data,
const Matrix< float > &    member,
float    largestChange
 

Vector< float > KMeans::distribution const Vector< float > &    point [virtual]
 

Return a probability distribution over the classes. Row number in the returned Vector corresponds to class number.

Implements fl::ClusterMethod.

void KMeans::estimate const std::vector< Vector< float > > &    data,
Matrix< float > &    member,
int    jbegin,
int    jend
 

void KMeans::initialize const std::vector< Vector< float > > &    data
 

float KMeans::maximize const std::vector< Vector< float > > &    data,
const Matrix< float > &    member,
int    i
 

void KMeans::read std::istream &    stream [virtual]
 

Reimplemented from fl::ClusterMethod.

Vector< float > KMeans::representative int    group [virtual]
 

Return a representative member of group. "group" has same semantics as return value of classify (); we just can't use the word "class" because it is a keyword in C++. :).

Implements fl::ClusterMethod.

void KMeans::run const std::vector< Vector< float > > &    data [virtual]
 

Peform clustering on collection of points.

Implements fl::ClusterMethod.

Reimplemented in fl::KMeansParallel.

void KMeans::write std::ostream &    stream,
bool    withName = false
[virtual]
 

Reimplemented from fl::ClusterMethod.


Member Data Documentation

std::vector<float> fl::KMeans::changes
 

std::string fl::KMeans::clusterFileName
 

off_t fl::KMeans::clusterFileSize
 

time_t fl::KMeans::clusterFileTime
 

Time in seconds.

std::vector<ClusterGauss> fl::KMeans::clusters
 

int fl::KMeans::initialK
 

Lower bound on expected number of clusters.

int fl::KMeans::maxK
 

Largest number of clusters allowed.

float fl::KMeans::maxSize
 

Largest length of dominant axis of covariance matrix. If any cluster exceeds this value, create a new cluster.

float fl::KMeans::minSize
 

Closest that two clusters can be before they merge.

std::vector<float> fl::KMeans::velocities
 


The documentation for this class was generated from the following files:
Generated on Thu Dec 9 17:13:26 2004 for fl by doxygen1.2.18