SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
List of all members | Public Member Functions
CKNNHeap Class Reference

Detailed Description

This class implements a specialized version of max heap structure. This heap specializes in storing the least k values seen so far along with the indices (or id) of the entities with which the values are associated. On calling the push method, it is automatically checked, if the new value supplied, is among the least k distances seen so far. Also, in case the heap is full already, the max among the stored values is automatically thrown out as the new value finds its proper place in the heap.

Definition at line 47 of file KNNHeap.h.

Public Member Functions

 CKNNHeap (int32_t k=1)
 
 ~CKNNHeap ()
 
void push (index_t index, float64_t dist)
 
float64_t get_max_dist ()
 
index_t get_max_index ()
 
SGVector< float64_tget_dists ()
 
SGVector< index_tget_indices ()
 

Constructor & Destructor Documentation

CKNNHeap ( int32_t  k = 1)

constructor

Parameters
kheap capacity i.e. the number of least distance values to be stored

Definition at line 37 of file KNNHeap.cpp.

~CKNNHeap ( )

destructor

Definition at line 57 of file KNNHeap.h.

Member Function Documentation

SGVector< float64_t > get_dists ( )

get distances

Returns
distances stored in the heap

Definition at line 100 of file KNNHeap.cpp.

SGVector< index_t > get_indices ( )

get indices

Returns
indices stored in the heap

Definition at line 123 of file KNNHeap.cpp.

float64_t get_max_dist ( )

max distance

Returns
max distance value stored in the heap

Definition at line 70 of file KNNHeap.h.

index_t get_max_index ( )

max index

Returns
vector id of the max distance stored

Definition at line 76 of file KNNHeap.h.

void push ( index_t  index,
float64_t  dist 
)

push into heap

Parameters
indexvector id whose distance value is pushed into the heap
distdistance value of the vector id index from the query point

Definition at line 51 of file KNNHeap.cpp.


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

SHOGUN Machine Learning Toolbox - Documentation