/** 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()); }
/** * 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; } }
new UniformRealDistribution(new JDKRandomGenerator(100), -minDelta, minDelta);
@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 RandomGenerator get() { return new JDKRandomGenerator(); } }
/** 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()); }
/** 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()); }
public RandomGenerator() { this.randomDataGenerator = new RandomDataGenerator(new JDKRandomGenerator()); }
public RandomGenerator(int seed) { this.randomDataGenerator = new RandomDataGenerator(new JDKRandomGenerator(seed)); }
@Override public JDKRandomGenerator generator() { JDKRandomGenerator random = new JDKRandomGenerator(); random.setSeed(seed); return random; } }
@Override public Distribution get() { return new DistributionBoundApache(new UniformRealDistribution(new JDKRandomGenerator(), min, max + 1), min, max); } }
@Override public Distribution get() { return new DistributionOffsetApache(new ExponentialDistribution(new JDKRandomGenerator(), mean, ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY), min, max); } }
@Override public Distribution get() { return new DistributionOffsetApache(new WeibullDistribution(new JDKRandomGenerator(), shape, scale, WeibullDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY), min, max); } }
@Override public Distribution get() { return new DistributionBoundApache(new NormalDistribution(new JDKRandomGenerator(), mean, stdev, NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY), min, max); } }
@Override public JDKRandomGenerator generator() { JDKRandomGenerator random = new JDKRandomGenerator(); random.setSeed(seed); return random; } }
@Override public JDKRandomGenerator generator() { JDKRandomGenerator random = new JDKRandomGenerator(); random.setSeed(seed); return random; } }
@Override public Distribution get() { return new DistributionQuantized(new DistributionOffsetApache(new WeibullDistribution(new JDKRandomGenerator(), shape, scale, WeibullDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY), min, max), quantas); } }
public RandomGeneratorImpl() { JDKRandomGenerator rg = new JDKRandomGenerator(); rg.setSeed(System.currentTimeMillis()); generator = new UniformRandomGenerator(rg); }
public void generateStartValues(RealMatrix x, RealMatrix mean, RealMatrix cov){ JDKRandomGenerator jg = new JDKRandomGenerator(); NormalizedRandomGenerator rg = new GaussianRandomGenerator(jg); CorrelatedRandomVectorGenerator sg = null; sg = new CorrelatedRandomVectorGenerator(mean.getColumn(0), cov, 0.00001, rg); mu = new Array2DRowRealMatrix(sg.nextVector()); }