List of usage examples for org.apache.mahout.common RandomWrapper getRandomGenerator
public RandomGenerator getRandomGenerator()
From source file:org.codelibs.elasticsearch.taste.common.SamplingLongPrimitiveIterator.java
License:Apache License
public SamplingLongPrimitiveIterator(final RandomWrapper random, final LongPrimitiveIterator delegate, final double samplingRate) { Preconditions.checkNotNull(delegate); Preconditions.checkArgument(samplingRate > 0.0 && samplingRate <= 1.0, "Must be: 0.0 < samplingRate <= 1.0"); // Geometric distribution is special case of negative binomial (aka Pascal) with r=1: geometricDistribution = new PascalDistribution(random.getRandomGenerator(), 1, samplingRate); this.delegate = delegate; hasNext = true;//w ww.java2s . c om doNext(); }
From source file:org.gpfvic.mahout.cf.taste.impl.common.SamplingLongPrimitiveIterator.java
License:Apache License
public SamplingLongPrimitiveIterator(RandomWrapper random, LongPrimitiveIterator delegate, double samplingRate) { Preconditions.checkNotNull(delegate); Preconditions.checkArgument(samplingRate > 0.0 && samplingRate <= 1.0, "Must be: 0.0 < samplingRate <= 1.0"); // Geometric distribution is special case of negative binomial (aka Pascal) with r=1: geometricDistribution = new PascalDistribution(random.getRandomGenerator(), 1, samplingRate); this.delegate = delegate; this.hasNext = true; doNext();//from w ww .ja va 2s .co m }