rehashing
Public Member Functions | Public Attributes | List of all members
HashBucket Class Reference

#include <HashBucket.h>

Public Member Functions

 HashBucket ()
 
 HashBucket (VectorXd p)
 
 HashBucket (VectorXd p, double wi)
 
 HashBucket (VectorXd p, double wi, int idx, int nscales)
 
void update (VectorXd p, std::mt19937_64 &rng)
 
void update (VectorXd p, double wi, std::mt19937_64 &rng)
 
void update (VectorXd p, double wi, int idx, std::mt19937_64 &rng)
 

Public Attributes

int SCALES = 1
 
vector< int > count
 
vector< VectorXd > sample
 
vector< double > wSum
 
std::uniform_real_distribution unif
 

Detailed Description

Hash bucket for LSH tables

Constructor & Destructor Documentation

◆ HashBucket() [1/4]

HashBucket::HashBucket ( )
inline

Default constructor.

◆ HashBucket() [2/4]

HashBucket::HashBucket ( VectorXd  p)
inline

Build a new hash bucket for data point p.

Parameters
pa data point that belongs to the bucket

◆ HashBucket() [3/4]

HashBucket::HashBucket ( VectorXd  p,
double  wi 
)
inline

Build a new hash bucket for data point p and weight wi.

Parameters
pa data point that belongs to the bucket
wiweight of the data point

◆ HashBucket() [4/4]

HashBucket::HashBucket ( VectorXd  p,
double  wi,
int  idx,
int  nscales 
)
inline

Build a new hash bucket for data point p, weight wi, scale idx out of a total of nscales scales

Parameters
pdata
wiweight
idxindex of scale that p falls into in the bucket
nscalestotal number of scales

Member Function Documentation

◆ update() [1/3]

void HashBucket::update ( VectorXd  p,
std::mt19937_64 &  rng 
)
inline

Insert point into bucket: update count and replace bucket sample with reservoir sampling.

Parameters
pdata point
rngrandom number generator

◆ update() [2/3]

void HashBucket::update ( VectorXd  p,
double  wi,
std::mt19937_64 &  rng 
)
inline

Insert point p with weight wi into bucket: update count and replace bucket sample with weighted reservoir sampling (A-Chao).

Parameters
pdata point
wiweight of data point
rngrandom number generator

◆ update() [3/3]

void HashBucket::update ( VectorXd  p,
double  wi,
int  idx,
std::mt19937_64 &  rng 
)
inline

Insert point p with weight wi, belonging to scale idx into bucket: update count and replace bucket sample with weighted reservoir sampling (A-Chao). Note that samples for each scale is stored and updated separately.

Parameters
pdata point
wiweight of data point
idxscale idx of data point
rngrandom number generator

Member Data Documentation

◆ count

vector<int> HashBucket::count

Count of data points that falls into the bucket

◆ sample

vector<VectorXd> HashBucket::sample

Samples of data points that falls into the bucket

◆ SCALES

int HashBucket::SCALES = 1

Store SCALES data samples per bucket, one from each weight scale. Comparing to storing 1 sample per bucket (default), storing more samples slightly longer but is more accurate. We do not recommend setting this to more than 3.

◆ wSum

vector<double> HashBucket::wSum

Sum of weights of all data points that falls into the bucket.


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