SHOGUN  6.1.3
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()

CKNNHeap ( int32_t  k = 1)


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

Definition at line 37 of file KNNHeap.cpp.

◆ ~CKNNHeap()

~CKNNHeap ( )


Definition at line 57 of file KNNHeap.h.

Member Function Documentation

◆ get_dists()

SGVector< float64_t > get_dists ( )

get distances

distances stored in the heap

Definition at line 100 of file KNNHeap.cpp.

◆ get_indices()

SGVector< index_t > get_indices ( )

get indices

indices stored in the heap

Definition at line 123 of file KNNHeap.cpp.

◆ get_max_dist()

float64_t get_max_dist ( )

max distance

max distance value stored in the heap

Definition at line 70 of file KNNHeap.h.

◆ get_max_index()

index_t get_max_index ( )

max index

vector id of the max distance stored

Definition at line 76 of file KNNHeap.h.

◆ push()

void push ( index_t  index,
float64_t  dist 

push into heap

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