SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions
CKernelDistance Class Reference

Detailed Description

The Kernel distance takes a distance as input.

It turns a kernel into something distance like by computing

\[ d({\bf x}, {\bf x'}) = e^{-\frac{k({\bf x}, {\bf x'})}{width}} \]

Definition at line 33 of file KernelDistance.h.

Inheritance diagram for CKernelDistance:
Inheritance graph
[legend]

Public Member Functions

 CKernelDistance ()
 
 CKernelDistance (float64_t width, CKernel *k)
 
 CKernelDistance (CFeatures *l, CFeatures *r, float64_t width, CKernel *k)
 
virtual ~CKernelDistance ()
 
virtual bool init (CFeatures *l, CFeatures *r)
 
virtual EDistanceType get_distance_type ()
 
virtual EFeatureType get_feature_type ()
 
virtual EFeatureClass get_feature_class ()
 
virtual const char * get_name () const
 
virtual void cleanup ()
 
- Public Member Functions inherited from CDistance
 CDistance ()
 
 CDistance (CFeatures *lhs, CFeatures *rhs)
 
virtual ~CDistance ()
 
float64_t distance (int32_t idx_a, int32_t idx_b)
 
SGMatrix< float64_tget_distance_matrix ()
 
virtual float64_tget_distance_matrix_real (int32_t &m, int32_t &n, float64_t *target)
 
virtual float32_tget_distance_matrix_shortreal (int32_t &m, int32_t &n, float32_t *target)
 
void load (CFile *loader)
 
void save (CFile *writer)
 
CFeaturesget_lhs ()
 
CFeaturesget_rhs ()
 
CFeaturesreplace_rhs (CFeatures *rhs)
 
virtual void remove_lhs_and_rhs ()
 
virtual void remove_lhs ()
 takes all necessary steps if the lhs is removed from distance matrix More...
 
virtual void remove_rhs ()
 takes all necessary steps if the rhs is removed from distance matrix More...
 
bool get_precompute_matrix ()
 
virtual void set_precompute_matrix (bool flag)
 
int32_t get_num_vec_lhs ()
 
int32_t get_num_vec_rhs ()
 
bool has_features ()
 
bool lhs_equals_rhs ()
 
- Public Member Functions inherited from CSGObject
 CSGObject ()
 
 CSGObject (const CSGObject &orig)
 
virtual ~CSGObject ()
 
virtual bool is_generic (EPrimitiveType *generic) const
 
template<class T >
void set_generic ()
 
void unset_generic ()
 
virtual void print_serializable (const char *prefix="")
 
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
 
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
 
void set_global_io (SGIO *io)
 
SGIOget_global_io ()
 
void set_global_parallel (Parallel *parallel)
 
Parallelget_global_parallel ()
 
void set_global_version (Version *version)
 
Versionget_global_version ()
 
SGVector< char * > get_modelsel_names ()
 
char * get_modsel_param_descr (const char *param_name)
 
index_t get_modsel_param_index (const char *param_name)
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 

Protected Member Functions

float64_t compute (int32_t idx_a, int32_t idx_b)
 
- Protected Member Functions inherited from CDistance
void do_precompute_matrix ()
 matrix precomputation More...
 
- Protected Member Functions inherited from CSGObject
virtual void load_serializable_pre () throw (ShogunException)
 
virtual void load_serializable_post () throw (ShogunException)
 
virtual void save_serializable_pre () throw (ShogunException)
 
virtual void save_serializable_post () throw (ShogunException)
 

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
 
Parallelparallel
 
Versionversion
 
Parameterm_parameters
 
Parameterm_model_selection_parameters
 
- Static Protected Member Functions inherited from CDistance
static void * run_distance_thread (void *p)
 run distance thread More...
 
- Protected Attributes inherited from CDistance
float32_tprecomputed_matrix
 
bool precompute_matrix
 
CFeatureslhs
 feature vectors to occur on left hand side More...
 
CFeaturesrhs
 feature vectors to occur on right hand side More...
 

Constructor & Destructor Documentation

default constructor

Definition at line 20 of file KernelDistance.cpp.

CKernelDistance ( float64_t  width,
CKernel k 
)

constructor

Parameters
widthwidth
kkernel

Definition at line 25 of file KernelDistance.cpp.

CKernelDistance ( CFeatures l,
CFeatures r,
float64_t  width,
CKernel k 
)

constructor

Parameters
lfeatures of left-hand side
rfeatures of right-hand side
widthwidth
kkernel

Definition at line 36 of file KernelDistance.cpp.

~CKernelDistance ( )
virtual

destructor

Definition at line 50 of file KernelDistance.cpp.

Member Function Documentation

virtual void cleanup ( )
virtual

clean up kernel

Implements CDistance.

Definition at line 93 of file KernelDistance.h.

float64_t compute ( int32_t  idx_a,
int32_t  idx_b 
)
protectedvirtual

compute kernel function for features a and b idx_{a,b} denote the index of the feature vectors in the corresponding feature object

Parameters
idx_aindex a
idx_bindex b
Returns
computed kernel function at indices a,b

Implements CDistance.

Definition at line 65 of file KernelDistance.cpp.

virtual EDistanceType get_distance_type ( )
virtual

return what type of kernel we are

Returns
distance type DISTANCE

Implements CDistance.

Definition at line 71 of file KernelDistance.h.

virtual EFeatureClass get_feature_class ( )
virtual

return feature class the distance can deal with

Returns
feature class of distance used

Implements CDistance.

Definition at line 82 of file KernelDistance.h.

virtual EFeatureType get_feature_type ( )
virtual

return feature type the distance can deal with

Returns
feature type of distance used

Implements CDistance.

Definition at line 76 of file KernelDistance.h.

virtual const char* get_name ( ) const
virtual

return the distances's name

Returns
name Distance

Implements CSGObject.

Definition at line 88 of file KernelDistance.h.

bool init ( CFeatures l,
CFeatures r 
)
virtual

initialize kernel

Parameters
lfeatures of left-hand side
rfeatures of right-hand side
Returns
if initializing was successful

Reimplemented from CDistance.

Definition at line 58 of file KernelDistance.cpp.


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

SHOGUN Machine Learning Toolbox - Documentation