knncolle
Collection of KNN methods in C++
|
Wrapper around a builder with L2 normalization. More...
#include <L2Normalized.hpp>
Public Member Functions | |
L2NormalizedBuilder (std::unique_ptr< Builder< L2NormalizedMatrix< Matrix_ >, Float_ > > builder) | |
L2NormalizedBuilder (Builder< L2NormalizedMatrix< Matrix_ >, Float_ > *builder) | |
Prebuilt< typename Matrix_::dimension_type, typename Matrix_::index_type, Float_ > * | build_raw (const Matrix_ &data) const |
Public Member Functions inherited from knncolle::Builder< Matrix_, Float_ > | |
std::shared_ptr< Prebuilt< typename Matrix_::dimension_type, typename Matrix_::index_type, Float_ > > | build_shared (const Matrix_ &data) const |
std::unique_ptr< Prebuilt< typename Matrix_::dimension_type, typename Matrix_::index_type, Float_ > > | build_unique (const Matrix_ &data) const |
Wrapper around a builder with L2 normalization.
This class applies L2 normalization to each observation vector in its input matrix, and also constructs Searcher
instances that L2-normalize each query vector. The premise is that Euclidean distances on L2-normalized vectors are monotonic transformations of the cosine distance. Thus, given an arbitrary algorithm that finds nearest neighbors according to Euclidean distance, users can wrap the former's Builder
with this L2NormalizedBuilder
to obtain neighbors according to the cosine distance.
|
inline |
builder | Pointer to a Builder for an arbitrary neighbor search algorithm. This should be parametrized to accept an L2NormalizedMatrix wrapper around the intended matrix type. |
|
inline |
builder | Pointer to a Builder for an arbitrary neighbor search algorithm. This should be parametrized to accept an L2NormalizedMatrix wrapper around the intended matrix type. |
|
inlinevirtual |
Creates a L2NormalizedPrebuilt
instance.
Implements knncolle::Builder< Matrix_, Float_ >.