A generic DistanceMachine interface.
A distance machine is based on a a-priori choosen distance.
Definition at line 32 of file DistanceMachine.h.
Public Member Functions | |
CDistanceMachine () | |
virtual | ~CDistanceMachine () |
void | set_distance (CDistance *d) |
CDistance * | get_distance () |
void | distances_lhs (float64_t *result, int32_t idx_a1, int32_t idx_a2, int32_t idx_b) |
void | distances_rhs (float64_t *result, int32_t idx_b1, int32_t idx_b2, int32_t idx_a) |
virtual const char * | get_name (void) const |
virtual CLabels * | apply () |
virtual CLabels * | apply (CFeatures *data) |
virtual float64_t | apply (int32_t num) |
Protected Member Functions | |
virtual void | store_model_features () |
Static Protected Member Functions | |
static void * | run_distance_thread_lhs (void *p) |
static void * | run_distance_thread_rhs (void *p) |
Protected Attributes | |
CDistance * | distance |
CDistanceMachine | ( | ) |
default constructor
Definition at line 28 of file DistanceMachine.cpp.
~CDistanceMachine | ( | ) | [virtual] |
Definition at line 34 of file DistanceMachine.cpp.
CLabels * apply | ( | ) | [virtual] |
Classify all rhs features using the built clusters. Cluster index with smallest distance to to be classified element is returned
Implements CMachine.
Reimplemented in CKNN, and CHierarchical.
Definition at line 224 of file DistanceMachine.cpp.
float64_t apply | ( | int32_t | num | ) | [virtual] |
Apply machine to one example. Cluster index with smallest distance to to be classified element is returned
num | which example to apply machine to |
Reimplemented from CMachine.
Reimplemented in CKNN, and CHierarchical.
Definition at line 233 of file DistanceMachine.cpp.
Classify all provided features. Cluster index with smallest distance to to be classified element is returned
data | (test)data to be classified |
Implements CMachine.
Reimplemented in CKNN, and CHierarchical.
Definition at line 207 of file DistanceMachine.cpp.
void distances_lhs | ( | float64_t * | result, | |
int32_t | idx_a1, | |||
int32_t | idx_a2, | |||
int32_t | idx_b | |||
) |
get distance functions for lhs feature vectors going from a1 to a2 and rhs feature vector b
result | array of distance values | |
idx_a1 | first feature vector a1 at idx_a1 | |
idx_a2 | last feature vector a2 at idx_a2 | |
idx_b | feature vector b at idx_b |
Definition at line 51 of file DistanceMachine.cpp.
void distances_rhs | ( | float64_t * | result, | |
int32_t | idx_b1, | |||
int32_t | idx_b2, | |||
int32_t | idx_a | |||
) |
get distance functions for rhs feature vectors going from b1 to b2 and lhs feature vector a
result | array of distance values | |
idx_b1 | first feature vector a1 at idx_b1 | |
idx_b2 | last feature vector a2 at idx_b2 | |
idx_a | feature vector a at idx_a |
Definition at line 113 of file DistanceMachine.cpp.
CDistance* get_distance | ( | ) |
virtual const char* get_name | ( | void | ) | const [virtual] |
Returns the name of the SGSerializable instance. It MUST BE the CLASS NAME without the prefixed `C'.
Implements CSGObject.
Reimplemented in CKNN, CHierarchical, and CKMeans.
Definition at line 83 of file DistanceMachine.h.
void * run_distance_thread_lhs | ( | void * | p | ) | [static, protected] |
pthread function for compute distance values
p | thread parameter |
Definition at line 175 of file DistanceMachine.cpp.
void * run_distance_thread_rhs | ( | void * | p | ) | [static, protected] |
pthread function for compute distance values
p | thread parameter |
Definition at line 191 of file DistanceMachine.cpp.
void set_distance | ( | CDistance * | d | ) |
virtual void store_model_features | ( | ) | [protected, virtual] |
Ensures cluster centers are in lhs of underlying distance
NOT IMPLEMENTED! Base method. Is called automatically after train because flag is always true for distance machines. Since every distance machine has to make sure that cluster centers are in lhs of distance variable, it is unimplemented here and HAS to be implemented in subclasses.
Reimplemented from CMachine.
Reimplemented in CKNN, CHierarchical, and CKMeans.
Definition at line 121 of file DistanceMachine.h.
the distance
Definition at line 146 of file DistanceMachine.h.