Class PoissonSampler<T>
- java.lang.Object
-
- org.apache.flink.api.java.sampling.RandomSampler<T>
-
- org.apache.flink.api.java.sampling.PoissonSampler<T>
-
- Type Parameters:
T- The type of sample.
@Internal public class PoissonSampler<T> extends RandomSampler<T>
A sampler implementation based on the Poisson Distribution. While sampling elements with fraction and replacement, the selected number of each element follows a given poisson distribution.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.api.java.sampling.RandomSampler
emptyIterable, EPSILON
-
-
Constructor Summary
Constructors Constructor Description PoissonSampler(double fraction)Create a poisson sampler which can sample elements with replacement.PoissonSampler(double fraction, long seed)Create a poisson sampler which can sample elements with replacement.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<T>sample(Iterator<T> input)Sample the input elements, for each input element, generate its count following a poisson distribution.
-
-
-
Constructor Detail
-
PoissonSampler
public PoissonSampler(double fraction, long seed)Create a poisson sampler which can sample elements with replacement.- Parameters:
fraction- The expected count of each element.seed- Random number generator seed for internal PoissonDistribution.
-
PoissonSampler
public PoissonSampler(double fraction)
Create a poisson sampler which can sample elements with replacement.- Parameters:
fraction- The expected count of each element.
-
-
Method Detail
-
sample
public Iterator<T> sample(Iterator<T> input)
Sample the input elements, for each input element, generate its count following a poisson distribution.- Specified by:
samplein classRandomSampler<T>- Parameters:
input- Elements to be sampled.- Returns:
- The sampled result which is lazy computed upon input elements.
-
-