com.rapidminer.tools.math.sampling
Class OrderedSamplingWithoutReplacement

java.lang.Object
  extended by com.rapidminer.tools.math.sampling.OrderedSamplingWithoutReplacement

public class OrderedSamplingWithoutReplacement
extends java.lang.Object

Implements iterative, linear sampling without replacement. The size of the population and the size or fraction of the sample have to be given as parameters. The algorithm is based upon A.F. Bissell (1986): Ordered Random Selection Without Replacement. In: Applied Statistics, 35 (1), pp. 73-75.

Author:
Tobias Malbrecht

Constructor Summary
OrderedSamplingWithoutReplacement(RandomGenerator randomGenerator, int populationSize, double sampleRatio)
          Constructor for a relative fraction of elements.
OrderedSamplingWithoutReplacement(RandomGenerator randomGenerator, int populationSize, int sampleSize)
          Constructor for an absolute number of elements.
 
Method Summary
 boolean acceptElement()
          Include element in the sample.
static int[] getSampledIndices(RandomGenerator randomGenerator, int populationSize, int sampleSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderedSamplingWithoutReplacement

public OrderedSamplingWithoutReplacement(RandomGenerator randomGenerator,
                                         int populationSize,
                                         int sampleSize)
Constructor for an absolute number of elements.

Parameters:
randomGenerator - A RandomGenerator.
populationSize - The size of the population.
sampleSize - The size of the sample.

OrderedSamplingWithoutReplacement

public OrderedSamplingWithoutReplacement(RandomGenerator randomGenerator,
                                         int populationSize,
                                         double sampleRatio)
Constructor for a relative fraction of elements.

Parameters:
randomGenerator - A RandomGenerator.
populationSize - The size of the sample relative to the population size.
sampleRatio - The ratio of the sample.
Method Detail

getSampledIndices

public static int[] getSampledIndices(RandomGenerator randomGenerator,
                                      int populationSize,
                                      int sampleSize)

acceptElement

public boolean acceptElement()
Include element in the sample.

Returns:
flag whether to include an element in the sample


Copyright © 2001-2009 by Rapid-I