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.h39行定义。

继承图,类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 CLabelsclassify ()
virtual CLabelsclassify (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_tR
 radi of the clusters (size k)
float64_tmus
 centers of the clusters (size dimensions x k)

构造及析构函数文档

CKMeans ( )

default constructor

在文件KMeans.cpp29行定义。

CKMeans ( int32_t  k,
CDistance d 
)

constructor

参数:
kparameter k
ddistance

在文件KMeans.cpp35行定义。

~CKMeans ( ) [virtual]

在文件KMeans.cpp42行定义。


成员函数文档

virtual CLabels* classify ( ) [protected, virtual]

classify objects using the currently set features

返回:
classified labels

实现了CDistanceMachine

在文件KMeans.h199行定义。

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

classify objects

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

实现了CDistanceMachine

在文件KMeans.h210行定义。

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.cpp133行定义。

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.h138行定义。

virtual EClassifierType get_classifier_type ( ) [virtual]

get classifier type

返回:
classifier type KMEANS

重载CClassifier

在文件KMeans.h57行定义。

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.h166行定义。

int32_t get_dimensions ( )

get dimensions

返回:
number of dimensions

在文件KMeans.h182行定义。

int32_t get_k ( )

get k

返回:
the parameter k

在文件KMeans.h97行定义。

float64_t get_max_iter ( )

get maximum number of iterations

返回:
maximum number of iterations

在文件KMeans.h116行定义。

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

重载CDistanceMachine

在文件KMeans.h219行定义。

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.h126行定义。

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.h150行定义。

bool load ( FILE *  srcfile) [virtual]

load distance machine from file

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

重载CClassifier

在文件KMeans.cpp72行定义。

bool save ( FILE *  dstfile) [virtual]

save distance machine to file

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

重载CClassifier

在文件KMeans.cpp79行定义。

void set_k ( int32_t  p_k)

set k

参数:
p_knew k

在文件KMeans.h87行定义。

void set_max_iter ( int32_t  iter)

set maximum number of iterations

参数:
iterthe new maximum

在文件KMeans.h106行定义。

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.cpp48行定义。


成员数据文档

int32_t dimensions [protected]

number of dimensions

在文件KMeans.h229行定义。

int32_t k [protected]

the k parameter in KMeans

在文件KMeans.h226行定义。

int32_t max_iter [protected]

maximum number of iterations

在文件KMeans.h223行定义。

float64_t* mus [protected]

centers of the clusters (size dimensions x k)

在文件KMeans.h235行定义。

float64_t* R [protected]

radi of the clusters (size k)

在文件KMeans.h232行定义。


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

SHOGUN Machine Learning Toolbox - Documentation