Sleipnir
Static Public Member Functions
Sleipnir::CClustKMeans Class Reference

Utility class containing static k-means clustering methods. More...

#include <clustkmeans.h>

Inheritance diagram for Sleipnir::CClustKMeans:
Sleipnir::CClustKMeansImpl

Static Public Member Functions

static bool Cluster (const CDataMatrix &MatData, const IMeasure *pMeasure, size_t iK, std::vector< uint16_t > &vecsClusters, const CDataMatrix *pMatWeights=NULL)
 Cluster a set of elements into k groups using the given data and pairwise similarity score.
static bool Cluster (const CDistanceMatrix &MatSimilarities, size_t iK, std::vector< uint16_t > &vecsClusters)
 Cluster a set of elements into k groups using the given pairwise similarities.

Detailed Description

Utility class containing static k-means clustering methods.

Definition at line 36 of file clustkmeans.h.


Member Function Documentation

bool Sleipnir::CClustKMeans::Cluster ( const CDataMatrix MatData,
const IMeasure pMeasure,
size_t  iK,
std::vector< uint16_t > &  vecsClusters,
const CDataMatrix pMatWeights = NULL 
) [static]

Cluster a set of elements into k groups using the given data and pairwise similarity score.

Parameters:
MatDataData vectors for each element, generally microarray values from a PCL file.
pMeasureSimilarity measure to use for clustering.
iKNumber of clusters to generate.
vecsClustersOutput cluster IDs for each gene.
pMatWeightsIf non-null, weights to use for each gene/condition value. These can be used to up/downweight aneuploidies present under only certain conditions, for example. Default assumes all ones.
Returns:
True if clustering succeeded.

Performs k-means clustering on the given data using the specified similarity measure and number of clusters. The indices of each element's final cluster are indicated in the output vector. If given, individual gene/condition scores can be weighted (e.g. to up/downweight aneuploidies present only under certain conditions). During k-means clustering, K centers are initially chosen at random. Each gene is assigned to the center most similar to it, and the centers are moved to the mean of their assigned genes. This process is iterated until no gene assignments change. This places each gene in exactly one cluster.

Remarks:
The size of MatData must be at least iK; on successful return, the size of vecsClusters will be equal to the size of MatData.
See also:
CClustHierarchical::Cluster

Definition at line 67 of file clustkmeans.cpp.

References Sleipnir::CFullMatrix< tType >::Clear(), Sleipnir::IMeasure::EMapNone, Sleipnir::CFullMatrix< tType >::Get(), Sleipnir::CFullMatrix< tType >::GetColumns(), Sleipnir::CFullMatrix< tType >::GetRows(), Sleipnir::CFullMatrix< tType >::Initialize(), Sleipnir::CMeta::IsNaN(), and Sleipnir::IMeasure::Measure().

bool Sleipnir::CClustKMeans::Cluster ( const CDistanceMatrix MatSimilarities,
size_t  iK,
std::vector< uint16_t > &  vecsClusters 
) [static]

Cluster a set of elements into k groups using the given pairwise similarities.

Parameters:
MatSimilaritiesMatrix of precalculated pairwise similarities between elements to be clustered.
iKNumber of clusters to generate.
vecsClustersOutput cluster IDs for each gene.
Returns:
True if clustering succeeded.

Performs k-means clustering on the given data using the specified similarites and number of clusters. The indices of each element's final cluster are indicated in the output vector. During k-means clustering, K centers are initially chosen at random. Each gene is assigned to the center most similar to it, and the centers are moved to the mean of their assigned genes. This process is iterated until no gene assignments change. This places each gene in exactly one cluster.

Remarks:
The size of MatSimilarities must be at least iK; on successful return, the size of vecsClusters will be equal to the size of MatSimilarities.
See also:
CClustHierarchical::Cluster

Definition at line 152 of file clustkmeans.cpp.

References Sleipnir::CFullMatrix< tType >::Clear(), Sleipnir::CFullMatrix< tType >::Get(), Sleipnir::CHalfMatrix< tType >::Get(), Sleipnir::CFullMatrix< tType >::GetColumns(), Sleipnir::CFullMatrix< tType >::GetRows(), Sleipnir::CHalfMatrix< tType >::GetSize(), Sleipnir::CFullMatrix< tType >::Initialize(), Sleipnir::CMeta::IsNaN(), and Sleipnir::CFullMatrix< tType >::Set().


The documentation for this class was generated from the following files: