/** Build a clusterer. * <p> * The default strategy for handling empty clusters that may appear during * algorithm iterations is to split the cluster with largest distance variance. * * @param k the number of clusters to split the data into * @param maxIterations the maximum number of iterations to run the algorithm for. * If negative, no maximum will be used. * @param measure the distance measure to use */ public KMeansPlusPlusClusterer(final int k, final int maxIterations, final DistanceMeasure measure) { this(k, maxIterations, measure, new JDKRandomGenerator()); }
@Override public JDKRandomGenerator generator() { JDKRandomGenerator random = new JDKRandomGenerator(); random.setSeed(seed); return random; } }
@Override protected JDKRandomGenerable next() { return new JDKRandomGenerable(random.nextLong()); }
public JDKRandomGeneratorFactory(long seed) { random.setSeed(seed); }
/** * Create a new JDKRandomGenerator with the given seed. * * @param seed initial seed * @since 3.6 */ public JDKRandomGenerator(int seed) { setSeed(seed); }
/** * Creates a new instance of a FuzzyKMeansClusterer. * * @param k the number of clusters to split the data into * @param fuzziness the fuzziness factor, must be > 1.0 * @param maxIterations the maximum number of iterations to run the algorithm for. * If negative, no maximum will be used. * @param measure the distance measure to use * @throws NumberIsTooSmallException if {@code fuzziness <= 1.0} */ public FuzzyKMeansClusterer(final int k, final double fuzziness, final int maxIterations, final DistanceMeasure measure) throws NumberIsTooSmallException { this(k, fuzziness, maxIterations, measure, DEFAULT_EPSILON, new JDKRandomGenerator()); }
@Override public JDKRandomGenerator generator() { JDKRandomGenerator random = new JDKRandomGenerator(); random.setSeed(seed); return random; } }
/** {@inheritDoc} */ public void setSeed(int seed) { setSeed((long) seed); }
@Override protected JDKRandomGenerable next() { return new JDKRandomGenerable(random.nextLong()); }
new UniformRealDistribution(new JDKRandomGenerator(100), -minDelta, minDelta);
@Override public JDKRandomGenerator generator() { JDKRandomGenerator random = new JDKRandomGenerator(); random.setSeed(seed); return random; } }
/** {@inheritDoc} */ public void setSeed(int[] seed) { setSeed(RandomGeneratorFactory.convertToLong(seed)); } }
@Override protected JDKRandomGenerable next() { return new JDKRandomGenerable(random.nextLong()); }
@Test public void testNormalDistribution() { NormalDistribution normalDistribution = new NormalDistribution( new JDKRandomGenerator(1000), 50000, 10000 ); FixedBucketsHistogram h = new FixedBucketsHistogram( 0, 100000, 1000, FixedBucketsHistogram.OutlierHandlingMode.OVERFLOW ); for (int i = 0; i < 100000; i++) { double val = normalDistribution.sample(); h.add(val); } float[] quantiles = h.percentilesFloat(new double[]{12.5f, 25.0f, 50.0f, 98f}); Assert.assertArrayEquals( new float[]{38565.324f, 43297.95f, 50091.902f, 70509.125f}, quantiles, 0.01f ); }
@Override public JDKRandomGenerator generator() { JDKRandomGenerator random = new JDKRandomGenerator(); random.setSeed(seed); return random; } }
/** * Create a new JDKRandomGenerator with the given seed. * * @param seed initial seed * @since 3.6 */ public JDKRandomGenerator(int seed) { setSeed(seed); }
@Override protected JDKRandomGenerable next() { return new JDKRandomGenerable(random.nextLong()); }
@Override public RandomGenerator get() { return new JDKRandomGenerator(); } }
public RandomGeneratorImpl() { JDKRandomGenerator rg = new JDKRandomGenerator(); rg.setSeed(System.currentTimeMillis()); generator = new UniformRandomGenerator(rg); }
/** * Create a new JDKRandomGenerator with the given seed. * * @param seed initial seed * @since 3.6 */ public JDKRandomGenerator(int seed) { setSeed(seed); }