Package org.apache.spark.util.random
Class PoissonSampler<T>
Object
org.apache.spark.util.random.PoissonSampler<T>
- Type Parameters:
- T- item type
- All Implemented Interfaces:
- Serializable,- Cloneable,- Pseudorandom,- RandomSampler<T,- T> 
:: DeveloperApi ::
 A sampler for sampling with replacement, based on values drawn from Poisson distribution.
 
param: fraction the sampling fraction (with replacement) param: useGapSamplingIfPossible if true, use gap sampling when sampling ratio is low.
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionPoissonSampler(double fraction) PoissonSampler(double fraction, boolean useGapSamplingIfPossible) 
- 
Method Summary
- 
Constructor Details- 
PoissonSamplerpublic PoissonSampler(double fraction, boolean useGapSamplingIfPossible) 
- 
PoissonSamplerpublic PoissonSampler(double fraction) 
 
- 
- 
Method Details- 
cloneDescription copied from interface:RandomSamplerreturn a copy of the RandomSampler object- Specified by:
- clonein interface- RandomSampler<T,- T> 
 
- 
samplepublic int sample()Description copied from interface:RandomSamplerWhether to sample the next item or not. Return how many times the next item will be sampled. Return 0 if it is not sampled.- Specified by:
- samplein interface- RandomSampler<T,- T> 
- Returns:
- (undocumented)
 
- 
sampleDescription copied from interface:RandomSamplertake a random sample- Specified by:
- samplein interface- RandomSampler<T,- T> 
 
- 
setSeedpublic void setSeed(long seed) Description copied from interface:PseudorandomSet random seed.- Specified by:
- setSeedin interface- Pseudorandom
 
 
-