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> scala.Cloneable,scala.Serializable
:: 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 Summary
ConstructorsConstructorDescriptionPoissonSampler(double fraction) PoissonSampler(double fraction, boolean useGapSamplingIfPossible)  - 
Method Summary
 
- 
Constructor Details
- 
PoissonSampler
public PoissonSampler(double fraction, boolean useGapSamplingIfPossible)  - 
PoissonSampler
public PoissonSampler(double fraction)  
 - 
 - 
Method Details
- 
clone
Description copied from interface:RandomSamplerreturn a copy of the RandomSampler object- Specified by:
 clonein interfaceRandomSampler<T,T> 
 - 
sample
public 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 interfaceRandomSampler<T,T> - Returns:
 - (undocumented)
 
 - 
sample
Description copied from interface:RandomSamplertake a random sample- Specified by:
 samplein interfaceRandomSampler<T,T> 
 - 
setSeed
public void setSeed(long seed) Description copied from interface:PseudorandomSet random seed.- Specified by:
 setSeedin interfacePseudorandom
 
 -