knncolle
Collection of KNN methods in C++
Loading...
Searching...
No Matches
Public Member Functions | List of all members
knncolle::L2NormalizedBuilder< Matrix_, Float_ > Class Template Reference

Wrapper around a builder with L2 normalization. More...

#include <L2Normalized.hpp>

Inheritance diagram for knncolle::L2NormalizedBuilder< Matrix_, Float_ >:
Inheritance graph
[legend]
Collaboration diagram for knncolle::L2NormalizedBuilder< Matrix_, Float_ >:
Collaboration graph
[legend]

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
 

Detailed Description

template<class Matrix_ = SimpleMatrix<int, int, double>, typename Float_ = double>
class knncolle::L2NormalizedBuilder< Matrix_, Float_ >

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.

Constructor & Destructor Documentation

◆ L2NormalizedBuilder() [1/2]

template<class Matrix_ = SimpleMatrix<int, int, double>, typename Float_ = double>
knncolle::L2NormalizedBuilder< Matrix_, Float_ >::L2NormalizedBuilder ( std::unique_ptr< Builder< L2NormalizedMatrix< Matrix_ >, Float_ > >  builder)
inline
Parameters
builderPointer to a Builder for an arbitrary neighbor search algorithm. This should be parametrized to accept an L2NormalizedMatrix wrapper around the intended matrix type.

◆ L2NormalizedBuilder() [2/2]

template<class Matrix_ = SimpleMatrix<int, int, double>, typename Float_ = double>
knncolle::L2NormalizedBuilder< Matrix_, Float_ >::L2NormalizedBuilder ( Builder< L2NormalizedMatrix< Matrix_ >, Float_ > *  builder)
inline
Parameters
builderPointer to a Builder for an arbitrary neighbor search algorithm. This should be parametrized to accept an L2NormalizedMatrix wrapper around the intended matrix type.

Member Function Documentation

◆ build_raw()

template<class Matrix_ = SimpleMatrix<int, int, double>, typename Float_ = double>
Prebuilt< typename Matrix_::dimension_type, typename Matrix_::index_type, Float_ > * knncolle::L2NormalizedBuilder< Matrix_, Float_ >::build_raw ( const Matrix_ &  data) const
inlinevirtual

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