Class ReservoirSampler<T>

java.lang.Object
org.apache.wayang.profiler.log.sampling.ReservoirSampler<T>
All Implemented Interfaces:
Sampler<T>

public abstract class ReservoirSampler<T> extends Object implements Sampler<T>
Utility to do reservoir sampling with competitions over shared space.
  • Constructor Details

    • ReservoirSampler

      public ReservoirSampler(int sampleSize)
  • Method Details

    • sample

      public List<T> sample(Collection<T> set, Battle<T> battle, double selectionProbability)
      Description copied from interface: Sampler
      Create a sample from a given Collection.
      Specified by:
      sample in interface Sampler<T>
      Parameters:
      set - the set of elements to be sampled from
      battle - lets two elements compete
      Returns:
      the sample; may contain nulls dependent on the implementation
    • letCompete

      protected abstract T letCompete(T candidate1, T candidate2, Random random)