libmoost
|
Classes | |
struct | FastHashFunctor |
functor that uses fast_hash More... | |
class | ketama_partitioner |
ketama_partitioner implements consistent hashing, such that the addition or removal of buckets does not significantly change the mapping of keys to buckets. By using consistent hashing, only K/n keys need to be remapped on average, where K is the number of keys, and n is the number of buckets. More... | |
class | modulo_partitioner |
modulo_partitioner hashes the key then modulos the result against the number of buckets. This results in an even spread given a reasonable hasher. More... | |
class | partitioner |
A partitioner can assign templatized types to a specified number of buckets. More... | |
struct | SimpleAccumulatorPolicy |
class | spline_interpolation |
Generate a spline interpolation of X and Y data points using the GNU Scientific Library. More... | |
struct | variable_length_encoding |
Typedefs | |
typedef FastHashFunctor | FastHash |
Functions | |
size_t | fast_hash (const void *data_in, size_t size, size_t seed=DEFAULT_SEED) |
free hash function | |
template<class ForwardIterator , class InputIterator > | |
ForwardIterator | inplace_set_intersection (ForwardIterator first1, ForwardIterator last1, InputIterator first2, InputIterator last2) |
template<class ForwardIterator , class InputIterator , class StrictWeakOrdering > | |
ForwardIterator | inplace_set_intersection (ForwardIterator first1, ForwardIterator last1, InputIterator first2, InputIterator last2, StrictWeakOrdering comp) |
template<typename FloatType , class ForwardIteratorX , class WeightAccessPolicyX , class ForwardIteratorY , class WeightAccessPolicyY , class AccumulatorPolicy > | |
FloatType | cosine_similarity (ForwardIteratorX x_beg, ForwardIteratorX x_end, WeightAccessPolicyX x_weight, ForwardIteratorY y_beg, ForwardIteratorY y_end, WeightAccessPolicyY y_weight, AccumulatorPolicy &accu) |
template<typename FloatType , class ForwardIteratorX , class WeightAccessPolicyX , class ForwardIteratorY , class WeightAccessPolicyY > | |
FloatType | cosine_similarity (ForwardIteratorX x_beg, ForwardIteratorX x_end, WeightAccessPolicyX x_weight, ForwardIteratorY y_beg, ForwardIteratorY y_end, WeightAccessPolicyY y_weight) |
Variables | |
static const size_t | DEFAULT_SEED = 5381 |
Definition at line 143 of file fast_hash.hpp.
FloatType moost::algorithm::cosine_similarity | ( | ForwardIteratorX | x_beg, |
ForwardIteratorX | x_end, | ||
WeightAccessPolicyX | x_weight, | ||
ForwardIteratorY | y_beg, | ||
ForwardIteratorY | y_end, | ||
WeightAccessPolicyY | y_weight, | ||
AccumulatorPolicy & | accu | ||
) |
Cosine similarity algorithm
This function template implements a generic cosine similarity algorithm for two arbitrary dimension feature vectors X and Y.
Note that this implementation requires both input vectors to be sorted and that dimensions of both vectors must be less-than comparable.
FloatType | Floating point type used for internal computation and return value. |
ForwardIteratorX | Iterator type of vector X. |
WeightAccessPolicyX | Policy for accessing the weight of a dimension in X. |
ForwardIteratorY | Iterator type of vector Y. |
WeightAccessPolicyY | Policy for accessing the weight of a dimension in Y. |
AccumulatorPolicy | Policy for summing the feature matches (dot product parts). Defaults to SimpleAccumulatorPolicy<FloatType>, but a different policy could be used e.g. for counting the number of matches. |
x_beg | Iterator to the start of vector X. |
x_end | Iterator to the end of vector X. |
x_weight | Policy to access the weight of a dimension in vector X. |
y_beg | Iterator to the start of vector Y. |
y_end | Iterator to the end of vector Y. |
y_weight | Policy to access the weight of a dimension in vector Y. |
accu | Accumulator policy. |
Definition at line 83 of file similarity.hpp.
FloatType moost::algorithm::cosine_similarity | ( | ForwardIteratorX | x_beg, |
ForwardIteratorX | x_end, | ||
WeightAccessPolicyX | x_weight, | ||
ForwardIteratorY | y_beg, | ||
ForwardIteratorY | y_end, | ||
WeightAccessPolicyY | y_weight | ||
) |
Definition at line 143 of file similarity.hpp.
size_t moost::algorithm::fast_hash | ( | const void * | data_in, |
size_t | size, | ||
size_t | seed = DEFAULT_SEED |
||
) | [inline] |
free hash function
Definition at line 92 of file fast_hash.hpp.
ForwardIterator moost::algorithm::inplace_set_intersection | ( | ForwardIterator | first1, |
ForwardIterator | last1, | ||
InputIterator | first2, | ||
InputIterator | last2 | ||
) |
Definition at line 42 of file inplace_set_intersection.hpp.
ForwardIterator moost::algorithm::inplace_set_intersection | ( | ForwardIterator | first1, |
ForwardIterator | last1, | ||
InputIterator | first2, | ||
InputIterator | last2, | ||
StrictWeakOrdering | comp | ||
) |
Definition at line 65 of file inplace_set_intersection.hpp.
const size_t moost::algorithm::DEFAULT_SEED = 5381 [static] |
Definition at line 87 of file fast_hash.hpp.