org.apache.spark.util.random
Class BernoulliCellSampler<T>

Object
  extended by org.apache.spark.util.random.BernoulliCellSampler<T>
All Implemented Interfaces:
java.io.Serializable, Cloneable, Pseudorandom, RandomSampler<T,T>

public class BernoulliCellSampler<T>
extends Object
implements 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:
Serialized Form

Constructor Summary
BernoulliCellSampler(double lb, double ub, boolean complement)
           
 
Method Summary
 BernoulliCellSampler<T> clone()
          return a copy of the RandomSampler object
 BernoulliCellSampler<T> cloneComplement()
          Return a sampler that is the complement of the range specified of the current sampler.
 scala.collection.Iterator<T> sample(scala.collection.Iterator<T> items)
          take a random sample
 void setSeed(long seed)
          Set random seed.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BernoulliCellSampler

public BernoulliCellSampler(double lb,
                            double ub,
                            boolean complement)
Method Detail

setSeed

public void setSeed(long seed)
Description copied from interface: Pseudorandom
Set random seed.

Specified by:
setSeed in interface Pseudorandom

sample

public scala.collection.Iterator<T> sample(scala.collection.Iterator<T> items)
Description copied from interface: RandomSampler
take a random sample

Specified by:
sample in interface RandomSampler<T,T>

cloneComplement

public BernoulliCellSampler<T> cloneComplement()
Return a sampler that is the complement of the range specified of the current sampler.

Returns:
(undocumented)

clone

public BernoulliCellSampler<T> clone()
Description copied from interface: RandomSampler
return a copy of the RandomSampler object

Specified by:
clone in interface RandomSampler<T,T>
Overrides:
clone in class Object