18 #include "jubatus/util/math/random.h"
19 #include "../common/hash.hpp"
20 #include "../common/type.hpp"
21 #include "../storage/bit_vector.hpp"
29 namespace nearest_neighbor {
32 vector<float> proj(hash_num);
33 for (
size_t i = 0; i < sfv.size(); ++i) {
35 jubatus::util::math::random::mtrand rnd(seed);
36 for (uint32_t j = 0; j < hash_num; ++j) {
37 proj[j] += sfv[i].second * rnd.next_gaussian();
45 for (
size_t i = 0; i < proj.size(); ++i) {
bit_vector binarize(const vector< float > &proj)
bit_vector_base< uint64_t > bit_vector
std::vector< std::pair< std::string, float > > sfv_t
bit_vector cosine_lsh(const common::sfv_t &sfv, uint32_t hash_num)
static uint64_t calc_string_hash(const std::string &s)
vector< float > random_projection(const common::sfv_t &sfv, uint32_t hash_num)