T - The type of sample.@Internal public class BernoulliSampler<T> extends RandomSampler<T>
emptyIterable, EPSILON| Constructor and Description |
|---|
BernoulliSampler(double fraction)
Create a Bernoulli sampler with sample fraction and default random number generator.
|
BernoulliSampler(double fraction,
long seed)
Create a Bernoulli sampler with sample fraction and random number generator seed.
|
BernoulliSampler(double fraction,
Random random)
Create a Bernoulli sampler with sample fraction and random number generator.
|
| Modifier and Type | Method and Description |
|---|---|
Iterator<T> |
sample(Iterator<T> input)
Sample the input elements, for each input element, take a Bernoulli trail for sampling.
|
public BernoulliSampler(double fraction)
fraction - Sample fraction, aka the Bernoulli sampler possibility.public BernoulliSampler(double fraction,
long seed)
fraction - Sample fraction, aka the Bernoulli sampler possibility.seed - Random number generator seed.public BernoulliSampler(double fraction,
Random random)
fraction - Sample fraction, aka the Bernoulli sampler possibility.random - The random number generator.public Iterator<T> sample(Iterator<T> input)
sample in class RandomSampler<T>input - Elements to be sampled.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.