#include <GDistribution.h>
List of all members.
Public Member Functions |
| GCategoricalSamplerBatch (size_t categories, const double *pDistribution, GRand &rand) |
| categories specifies the number of categories. pDistribution should specify a probability value for each category. They should sum to 1. pDistribution is expected to remain valid for the duration of this object.
|
| ~GCategoricalSamplerBatch () |
void | draw (size_t samples, size_t *pOutBatch) |
| This will draw a batch of samples from the categorical distribution. This method is implemented efficiently, such that it will draw them in O(samples + categories) time. (This is significantly faster than O(samples * log(categories)) time, which is what you get if you use GCategoricalSampler.)
|
Static Public Member Functions |
static void | test () |
Protected Attributes |
size_t | m_categories |
const double * | m_pDistribution |
size_t * | m_pIndexes |
GRand & | m_rand |
Constructor & Destructor Documentation
GClasses::GCategoricalSamplerBatch::GCategoricalSamplerBatch |
( |
size_t |
categories, |
|
|
const double * |
pDistribution, |
|
|
GRand & |
rand |
|
) |
| |
categories specifies the number of categories. pDistribution should specify a probability value for each category. They should sum to 1. pDistribution is expected to remain valid for the duration of this object.
GClasses::GCategoricalSamplerBatch::~GCategoricalSamplerBatch |
( |
| ) |
|
Member Function Documentation
void GClasses::GCategoricalSamplerBatch::draw |
( |
size_t |
samples, |
|
|
size_t * |
pOutBatch |
|
) |
| |
This will draw a batch of samples from the categorical distribution. This method is implemented efficiently, such that it will draw them in O(samples + categories) time. (This is significantly faster than O(samples * log(categories)) time, which is what you get if you use GCategoricalSampler.)
static void GClasses::GCategoricalSamplerBatch::test |
( |
| ) |
[static] |
Member Data Documentation