Brute force optimized nearest neighbor implementation. More...
#include <shark/Algorithms/NearestNeighbors/SimpleNearestNeighbors.h>
 Inheritance diagram for shark::SimpleNearestNeighbors< InputType, LabelType >:
 Inheritance diagram for shark::SimpleNearestNeighbors< InputType, LabelType >:| Public Types | |
| typedef LabeledData< InputType, LabelType > | Dataset | 
| typedef AbstractMetric< InputType > | Metric | 
| 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 | |
| SimpleNearestNeighbors (Dataset const &dataset, Metric const *metric) | |
| Constructor. | |
| std::vector< DistancePair > | getNeighbors (BatchInputType const &patterns, std::size_t k) const | 
| Return the k nearest neighbors of the query point. | |
| LabeledData< InputType, LabelType > const & | dataset () const | 
| Direct access to the underlying data set of nearest neighbor points. | |
|  Public Member Functions inherited from shark::AbstractNearestNeighbors< InputType, LabelType > | |
| Shape const & | inputShape () const | 
| Returns the expected shape of the inputs. | |
| virtual | ~AbstractNearestNeighbors () | 
| Additional Inherited Members | |
|  Protected Attributes inherited from shark::AbstractNearestNeighbors< InputType, LabelType > | |
| Shape | m_inputShape | 
Brute force optimized nearest neighbor implementation.
Returns the labels and distances of the k nearest neighbors of a point The distance is measured using an arbitrary metric
Definition at line 51 of file SimpleNearestNeighbors.h.
| typedef Batch<InputType>::type shark::SimpleNearestNeighbors< InputType, LabelType >::BatchInputType | 
Definition at line 58 of file SimpleNearestNeighbors.h.
| typedef LabeledData<InputType, LabelType> shark::SimpleNearestNeighbors< InputType, LabelType >::Dataset | 
Definition at line 55 of file SimpleNearestNeighbors.h.
| typedef base_type::DistancePair shark::SimpleNearestNeighbors< InputType, LabelType >::DistancePair | 
Definition at line 57 of file SimpleNearestNeighbors.h.
| typedef AbstractMetric<InputType> shark::SimpleNearestNeighbors< InputType, LabelType >::Metric | 
Definition at line 56 of file SimpleNearestNeighbors.h.
| 
 | inline | 
Constructor.
Definition at line 66 of file SimpleNearestNeighbors.h.
References shark::LabeledData< InputT, LabelT >::inputShape(), and shark::AbstractNearestNeighbors< InputType, LabelType >::m_inputShape.
| 
 | inlinevirtual | 
Direct access to the underlying data set of nearest neighbor points.
Implements shark::AbstractNearestNeighbors< InputType, LabelType >.
Definition at line 138 of file SimpleNearestNeighbors.h.
| 
 | inlinevirtual | 
Return the k nearest neighbors of the query point.
Implements shark::AbstractNearestNeighbors< InputType, LabelType >.
Definition at line 72 of file SimpleNearestNeighbors.h.
References shark::LabeledData< InputT, LabelT >::batch(), shark::batchSize(), shark::AbstractMetric< InputTypeT >::featureDistanceSqr(), shark::getBatchElement(), shark::LabeledData< InputT, LabelT >::numberOfBatches(), SHARK_NUM_THREADS, SHARK_PARALLEL_FOR, and SHARK_THREAD_NUM.