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

详细描述

The Custom Distance allows for custom user provided distance matrices.

For squared training matrices it allows to store only the upper triangle of the distance to save memory: Full symmetric distance matrices can be stored as is or can be internally converted into (or directly given in) upper triangle representation. Also note that values are stored as 32bit floats.

在文件CustomDistance.h29行定义。

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

所有成员的列表。

公有成员

 CCustomDistance ()
 CCustomDistance (CDistance *d)
 CCustomDistance (const float64_t *dm, int32_t rows, int32_t cols)
 CCustomDistance (const float32_t *dm, int32_t rows, int32_t cols)
virtual ~CCustomDistance ()
virtual bool dummy_init (int32_t rows, int32_t cols)
virtual bool init (CFeatures *l, CFeatures *r)
virtual void cleanup ()
virtual EDistanceType get_distance_type ()
virtual EFeatureType get_feature_type ()
virtual EFeatureClass get_feature_class ()
virtual const char * get_name () const
bool set_triangle_distance_matrix_from_triangle (const float64_t *dm, int32_t len)
bool set_triangle_distance_matrix_from_triangle (const float32_t *dm, int32_t len)
template<class T >
bool set_triangle_distance_matrix_from_triangle_generic (const T *dm, int64_t len)
bool set_triangle_distance_matrix_from_full (const float64_t *dm, int32_t rows, int32_t cols)
bool set_triangle_distance_matrix_from_full (const float32_t *dm, int32_t rows, int32_t cols)
template<class T >
bool set_triangle_distance_matrix_from_full_generic (const T *dm, int32_t rows, int32_t cols)
bool set_full_distance_matrix_from_full (const float64_t *dm, int32_t rows, int32_t cols)
bool set_full_distance_matrix_from_full (const float32_t *dm, int32_t rows, int32_t cols)
template<class T >
bool set_full_distance_matrix_from_full_generic (const T *dm, int32_t rows, int32_t cols)
virtual int32_t get_num_vec_lhs ()
virtual int32_t get_num_vec_rhs ()
virtual bool has_features ()

保护成员

virtual float64_t compute (int32_t row, int32_t col)

保护属性

float32_tdmatrix
int32_t num_rows
int32_t num_cols
bool upper_diagonal

构造及析构函数文档

default constructor

在文件CustomDistance.cpp19行定义。

constructor

compute custom distance from given distance matrix

参数:
ddistance matrix

在文件CustomDistance.cpp24行定义。

CCustomDistance ( const float64_t dm,
int32_t  rows,
int32_t  cols 
)

constructor

sets full distance matrix from full distance matrix (from double precision floats)

参数:
dmdistance matrix
rowsnumber of rows in matrix
colsnumber of cols in matrix
返回:
if setting was successful

在文件CustomDistance.cpp65行定义。

CCustomDistance ( const float32_t dm,
int32_t  rows,
int32_t  cols 
)

constructor

sets full distance matrix from full distance matrix (from single precision floats)

参数:
dmdistance matrix
rowsnumber of rows in matrix
colsnumber of cols in matrix
返回:
if setting was successful

在文件CustomDistance.cpp72行定义。

~CCustomDistance ( ) [virtual]

在文件CustomDistance.cpp79行定义。


成员函数文档

void cleanup ( ) [virtual]

clean up distance

实现了CDistance

在文件CustomDistance.cpp121行定义。

virtual float64_t compute ( int32_t  row,
int32_t  col 
) [protected, virtual]

compute distance function

参数:
rowrow
colcol
返回:
computed distance function

实现了CDistance

在文件CustomDistance.h358行定义。

bool dummy_init ( int32_t  rows,
int32_t  cols 
) [virtual]

initialize distance with dummy features

Distances always need feature objects assigned. As the custom distance does not really require this it creates some magic dummy features that only know about the number of vectors

参数:
rowsfeatures of left-hand side
colsfeatures of right-hand side
返回:
if initializing was successful

在文件CustomDistance.cpp84行定义。

virtual EDistanceType get_distance_type ( ) [virtual]

return what type of distance we are

返回:
distance type CUSTOM

实现了CDistance

在文件CustomDistance.h97行定义。

virtual EFeatureClass get_feature_class ( ) [virtual]

return feature class the distance can deal with

返回:
feature class ANY

实现了CDistance

在文件CustomDistance.h109行定义。

virtual EFeatureType get_feature_type ( ) [virtual]

return feature type the distance can deal with

返回:
feature type ANY

实现了CDistance

在文件CustomDistance.h103行定义。

virtual const char* get_name ( void  ) const [virtual]

return the distance's name

返回:
name Custom

实现了CSGObject

在文件CustomDistance.h115行定义。

virtual int32_t get_num_vec_lhs ( ) [virtual]

get number of vectors of lhs features

返回:
number of vectors of left-hand side

重载CDistance

在文件CustomDistance.h328行定义。

virtual int32_t get_num_vec_rhs ( ) [virtual]

get number of vectors of rhs features

返回:
number of vectors of right-hand side

重载CDistance

在文件CustomDistance.h337行定义。

virtual bool has_features ( ) [virtual]

test whether features have been assigned to lhs and rhs

返回:
true if features are assigned

重载CDistance

在文件CustomDistance.h346行定义。

bool init ( CFeatures l,
CFeatures r 
) [virtual]

initialize distance

参数:
lfeatures of left-hand side
rfeatures of right-hand side
返回:
if initializing was successful

重载CDistance

在文件CustomDistance.cpp89行定义。

bool set_full_distance_matrix_from_full ( const float32_t dm,
int32_t  rows,
int32_t  cols 
)

set full distance matrix from full distance matrix

for float32's

参数:
dmdistance matrix
rowsnumber of rows in matrix
colsnumber of cols in matrix
返回:
if setting was successful

在文件CustomDistance.h286行定义。

bool set_full_distance_matrix_from_full ( const float64_t dm,
int32_t  rows,
int32_t  cols 
)

set full distance matrix from full distance matrix

for float64's

参数:
dmdistance matrix
rowsnumber of rows in matrix
colsnumber of cols in matrix
返回:
if setting was successful

在文件CustomDistance.h271行定义。

bool set_full_distance_matrix_from_full_generic ( const T *  dm,
int32_t  rows,
int32_t  cols 
)

set full distance matrix from full distance matrix

参数:
dmdistance matrix
rowsnumber of rows in matrix
colsnumber of cols in matrix
返回:
if setting was successful

在文件CustomDistance.h300行定义。

bool set_triangle_distance_matrix_from_full ( const float64_t dm,
int32_t  rows,
int32_t  cols 
)

set distance matrix (only elements from upper triangle) from squared matrix

for float64's

参数:
dmdistance matrix
rowsnumber of rows in matrix
colsnumber of cols in matrix
返回:
if setting was successful

在文件CustomDistance.h205行定义。

bool set_triangle_distance_matrix_from_full ( const float32_t dm,
int32_t  rows,
int32_t  cols 
)

set distance matrix (only elements from upper triangle) from squared matrix

for float32's

参数:
dmdistance matrix
rowsnumber of rows in matrix
colsnumber of cols in matrix
返回:
if setting was successful

在文件CustomDistance.h221行定义。

bool set_triangle_distance_matrix_from_full_generic ( const T *  dm,
int32_t  rows,
int32_t  cols 
)

set distance matrix (only elements from upper triangle) from squared matrix

参数:
dmdistance matrix
rowsnumber of rows in matrix
colsnumber of cols in matrix
返回:
if setting was successful

在文件CustomDistance.h236行定义。

bool set_triangle_distance_matrix_from_triangle ( const float32_t dm,
int32_t  len 
)

set distance matrix (only elements from upper triangle) from elements of upper triangle (concat'd), including the main diagonal

small variant for floats32's, triangle needs to have less than 2**32 elements

参数:
dmdistance matrix
lendenotes the size of the array and should match len=cols*(cols+1)/2
返回:
if setting was successful

在文件CustomDistance.h143行定义。

bool set_triangle_distance_matrix_from_triangle ( const float64_t dm,
int32_t  len 
)

set distance matrix (only elements from upper triangle) from elements of upper triangle (concat'd), including the main diagonal

small variant for floats64's, triangle needs to have less than 2**32 elements

参数:
dmdistance matrix
lendenotes the size of the array and should match len=cols*(cols+1)/2
返回:
if setting was successful

在文件CustomDistance.h127行定义。

bool set_triangle_distance_matrix_from_triangle_generic ( const T *  dm,
int64_t  len 
)

set distance matrix (only elements from upper triangle) from elements of upper triangle (concat'd), including the main diagonal

big variant, allowing the triangle to have more than 2**31-1 elements

参数:
dmdistance matrix
lendenotes the size of the array and should match len=cols*(cols+1)/2
返回:
if setting was successful

在文件CustomDistance.h160行定义。


成员数据文档

float32_t* dmatrix [protected]

distance matrix

在文件CustomDistance.h390行定义。

int32_t num_cols [protected]

number of columns

在文件CustomDistance.h394行定义。

int32_t num_rows [protected]

number of rows

在文件CustomDistance.h392行定义。

bool upper_diagonal [protected]

upper diagonal

在文件CustomDistance.h396行定义。


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

SHOGUN Machine Learning Toolbox - Documentation