MCPcopy Create free account
hub / github.com/davisking/dlib / bucket

Function bucket

dlib/test/feature_hashing.cpp:22–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 using sparse_type = std::vector<std::pair<unsigned long,double>>;
21
22 unsigned long bucket (const std::string& s, unsigned long num_buckets)
23 {
24 return murmur_hash3(s.data(), s.size(), 0) % num_buckets;
25 }
26
27 // The expected counts, from the n-grams written out by hand.
28 sparse_type expected (const std::vector<std::string>& ngrams, unsigned long num_buckets)

Callers 1

expectedFunction · 0.70

Calls 3

murmur_hash3Function · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected