shark::TreeNearestNeighbors< InputType, LabelType > Class Template Reference

Nearest Neighbors implementation using binary trees. More...

#include <shark/Algorithms/NearestNeighbors/TreeNearestNeighbors.h>

+ Inheritance diagram for shark::TreeNearestNeighbors< InputType, LabelType >:

Public Types

typedef LabeledData< InputType, LabelType > Dataset
 
typedef BinaryTree< InputTypeTree
 
typedef base_type::DistancePair DistancePair
 
typedef Batch< InputType >::type BatchInputType
 
- Public Types inherited from shark::AbstractNearestNeighbors< InputType, LabelType >
typedef KeyValuePair< double, LabelType > DistancePair
 
typedef Batch< InputType >::type BatchInputType
 

Public Member Functions

 TreeNearestNeighbors (Dataset const &dataset, Tree const *tree)
 
std::vector< DistancePairgetNeighbors (BatchInputType const &patterns, std::size_t k) const
 returns the k nearest neighbors of the point More...
 
LabeledData< InputType, LabelType > const & dataset () const
 returns a const reference to the dataset used by the algorithm More...
 
- Public Member Functions inherited from shark::AbstractNearestNeighbors< InputType, LabelType >
Shape const & inputShape () const
 Returns the expected shape of the inputs. More...
 
virtual ~AbstractNearestNeighbors ()
 

Additional Inherited Members

- Protected Attributes inherited from shark::AbstractNearestNeighbors< InputType, LabelType >
Shape m_inputShape
 

Detailed Description

template<class InputType, class LabelType>
class shark::TreeNearestNeighbors< InputType, LabelType >

Nearest Neighbors implementation using binary trees.

Returns the labels and distances of the k nearest neighbors of a point.

Definition at line 408 of file TreeNearestNeighbors.h.

Member Typedef Documentation

◆ BatchInputType

template<class InputType , class LabelType >
typedef Batch<InputType>::type shark::TreeNearestNeighbors< InputType, LabelType >::BatchInputType

Definition at line 417 of file TreeNearestNeighbors.h.

◆ Dataset

template<class InputType , class LabelType >
typedef LabeledData<InputType, LabelType> shark::TreeNearestNeighbors< InputType, LabelType >::Dataset

Definition at line 414 of file TreeNearestNeighbors.h.

◆ DistancePair

template<class InputType , class LabelType >
typedef base_type::DistancePair shark::TreeNearestNeighbors< InputType, LabelType >::DistancePair

Definition at line 416 of file TreeNearestNeighbors.h.

◆ Tree

template<class InputType , class LabelType >
typedef BinaryTree<InputType> shark::TreeNearestNeighbors< InputType, LabelType >::Tree

Definition at line 415 of file TreeNearestNeighbors.h.

Constructor & Destructor Documentation

◆ TreeNearestNeighbors()

template<class InputType , class LabelType >
shark::TreeNearestNeighbors< InputType, LabelType >::TreeNearestNeighbors ( Dataset const &  dataset,
Tree const *  tree 
)
inline

Member Function Documentation

◆ dataset()

template<class InputType , class LabelType >
LabeledData<InputType,LabelType> const& shark::TreeNearestNeighbors< InputType, LabelType >::dataset ( ) const
inlinevirtual

returns a const reference to the dataset used by the algorithm

Implements shark::AbstractNearestNeighbors< InputType, LabelType >.

Definition at line 444 of file TreeNearestNeighbors.h.

◆ getNeighbors()

template<class InputType , class LabelType >
std::vector<DistancePair> shark::TreeNearestNeighbors< InputType, LabelType >::getNeighbors ( BatchInputType const &  patterns,
std::size_t  k 
) const
inlinevirtual

returns the k nearest neighbors of the point

Implements shark::AbstractNearestNeighbors< InputType, LabelType >.

Definition at line 429 of file TreeNearestNeighbors.h.

References shark::batchSize().


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