Package org.apache.spark.util.random
Class BernoulliCellSampler<T>
Object
org.apache.spark.util.random.BernoulliCellSampler<T>
- Type Parameters:
T
- item type
- All Implemented Interfaces:
Serializable
,Cloneable
,Pseudorandom
,RandomSampler<T,
T>
:: DeveloperApi ::
A sampler based on Bernoulli trials for partitioning a data sequence.
param: lb lower bound of the acceptance range param: ub upper bound of the acceptance range param: complement whether to use the complement of the range specified, default to false
- See Also:
-
Constructor Details
-
BernoulliCellSampler
public BernoulliCellSampler(double lb, double ub, boolean complement)
-
-
Method Details
-
setSeed
public void setSeed(long seed) Description copied from interface:Pseudorandom
Set random seed.- Specified by:
setSeed
in interfacePseudorandom
-
sample
public int sample()Description copied from interface:RandomSampler
Whether 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:
sample
in interfaceRandomSampler<T,
T> - Returns:
- (undocumented)
-
cloneComplement
Return a sampler that is the complement of the range specified of the current sampler.- Returns:
- (undocumented)
-
clone
Description copied from interface:RandomSampler
return a copy of the RandomSampler object- Specified by:
clone
in interfaceRandomSampler<T,
T>
-