SHOGUN v0.9.0
公有成员 | 保护成员 | 保护属性
CKMeans类参考

详细描述

KMeans clustering, partitions the data into k (a-priori specified) clusters.

It minimizes

\[ \sum_{i=1}^k\sum_{x_j\in S_i} (x_j-\mu_i)^2 \]

where $\mu_i$ are the cluster centers and $S_i,\;i=1,\dots,k$ are the index sets of the clusters.

Beware that this algorithm obtains only a local optimum.

cf. http://en.wikipedia.org/wiki/K-means_algorithm

在文件KMeans.h第39行定义。

继承图,类CKMeans
Inheritance graph
[图例]

所有成员的列表。

公有成员

 CKMeans ()
 CKMeans (int32_t k, CDistance *d)
virtual ~CKMeans ()
virtual EClassifierType get_classifier_type ()
virtual bool train (CFeatures *data=NULL)
virtual bool load (FILE *srcfile)
virtual bool save (FILE *dstfile)
void set_k (int32_t p_k)
int32_t get_k ()
void set_max_iter (int32_t iter)
float64_t get_max_iter ()
void get_radi (float64_t *&radi, int32_t &num)
void get_centers (float64_t *&centers, int32_t &dim, int32_t &num)
void get_radiuses (float64_t **radii, int32_t *num)
void get_cluster_centers (float64_t **centers, int32_t *dim, int32_t *num)
int32_t get_dimensions ()

保护成员

void clustknb (bool use_old_mus, float64_t *mus_start)
virtual CLabels * classify ()
virtual CLabels * classify (CFeatures *data)
virtual const char * get_name () const

保护属性

int32_t max_iter
 maximum number of iterations
int32_t k
 the k parameter in KMeans
int32_t dimensions
 number of dimensions
float64_t * R
 radi of the clusters (size k)
float64_t * mus
 centers of the clusters (size dimensions x k)

构造及析构函数文档

CKMeans ( )

default constructor

在文件KMeans.cpp第29行定义。

CKMeans ( int32_t  k,
CDistance *  d 
)

constructor

参数:
kparameter k
ddistance

在文件KMeans.cpp第35行定义。

~CKMeans ( ) [virtual]

在文件KMeans.cpp第42行定义。


成员函数文档

virtual CLabels* classify ( ) [protected, virtual]

classify objects using the currently set features

返回:
classified labels

实现了CDistanceMachine。

在文件KMeans.h第199行定义。

virtual CLabels* classify ( CFeatures *  data) [protected, virtual]

classify objects

参数:
data(test)data to be classified
返回:
classified labels

实现了CDistanceMachine。

在文件KMeans.h第210行定义。

void clustknb ( bool  use_old_mus,
float64_t *  mus_start 
) [protected]

clustknb

参数:
use_old_musif old mus shall be used
mus_startmus start

replace rhs feature vectors

set rhs to mus_start

update rhs

在文件KMeans.cpp第133行定义。

void get_centers ( float64_t *&  centers,
int32_t &  dim,
int32_t &  num 
)

get centers

参数:
centerscurrent centers are stored in here
dimdimensions are stored in here
numnumber of centers is stored in here

在文件KMeans.h第138行定义。

virtual EClassifierType get_classifier_type ( ) [virtual]

get classifier type

返回:
classifier type KMEANS

重载CClassifier。

在文件KMeans.h第57行定义。

void get_cluster_centers ( float64_t **  centers,
int32_t *  dim,
int32_t *  num 
)

get cluster centers (swig compatible)

参数:
centerscurrent cluster centers are stored in here
dimdimensions are stored in here
numnumber of centers is stored in here

在文件KMeans.h第166行定义。

int32_t get_dimensions ( )

get dimensions

返回:
number of dimensions

在文件KMeans.h第182行定义。

int32_t get_k ( )

get k

返回:
the parameter k

在文件KMeans.h第97行定义。

float64_t get_max_iter ( )

get maximum number of iterations

返回:
maximum number of iterations

在文件KMeans.h第116行定义。

virtual const char* get_name ( void  ) const [protected, virtual]
返回:
object name

重载CDistanceMachine。

在文件KMeans.h第219行定义。

void get_radi ( float64_t *&  radi,
int32_t &  num 
)

get radi

参数:
radicurrent radi are stored in here
numnumber of radi is stored in here

在文件KMeans.h第126行定义。

void get_radiuses ( float64_t **  radii,
int32_t *  num 
)

get radiuses (swig compatible)

参数:
radiicurrent radiuses are stored in here
numnumber of radiuses is stored in here

在文件KMeans.h第150行定义。

bool load ( FILE *  srcfile) [virtual]

load distance machine from file

参数:
srcfilefile to load from
返回:
if loading was successful

重载CClassifier。

在文件KMeans.cpp第72行定义。

bool save ( FILE *  dstfile) [virtual]

save distance machine to file

参数:
dstfilefile to save to
返回:
if saving was successful

重载CClassifier。

在文件KMeans.cpp第79行定义。

void set_k ( int32_t  p_k)

set k

参数:
p_knew k

在文件KMeans.h第87行定义。

void set_max_iter ( int32_t  iter)

set maximum number of iterations

参数:
iterthe new maximum

在文件KMeans.h第106行定义。

bool train ( CFeatures *  data = NULL) [virtual]

train k-means

参数:
datatraining data (parameter can be avoided if distance or kernel-based classifiers are used and distance/kernels are initialized with train data)
返回:
whether training was successful

重载CClassifier。

在文件KMeans.cpp第48行定义。


成员数据文档

int32_t dimensions [protected]

number of dimensions

在文件KMeans.h第229行定义。

int32_t k [protected]

the k parameter in KMeans

在文件KMeans.h第226行定义。

int32_t max_iter [protected]

maximum number of iterations

在文件KMeans.h第223行定义。

float64_t* mus [protected]

centers of the clusters (size dimensions x k)

在文件KMeans.h第235行定义。

float64_t* R [protected]

radi of the clusters (size k)

在文件KMeans.h第232行定义。


该类的文档由以下文件生成:

SHOGUN Machine Learning Toolbox - Documentation