Examples of RealDistribution


Examples of com.facebook.LinkBench.RealDistribution

    }

    // real distribution has it own initialization
    if (mode == LinkDistMode.REAL) {
      logger.debug("Using real link distribution");
      RealDistribution realDist = new RealDistribution();
      realDist.init(props, minid1, maxid1, DistributionType.LINKS);
      return new ProbLinkDistribution(realDist);
    } else {
      // Various arithmetic modes
      // an additional parameter for the function
      int nlinks_config = ConfigUtil.getInt(props, Config.NLINKS_CONFIG);
View Full Code Here

Examples of com.facebook.LinkBench.RealDistribution

    try {
      AccessDistMode mode = AccessDistMode.valueOf(access_func.toUpperCase());

      if (mode == AccessDistMode.REAL) {
        RealDistribution realDist = new RealDistribution();
        realDist.init(props, minid, maxid, kind);
        InvertibleShuffler shuffler = RealDistribution.getShuffler(kind,
                                                    maxid - minid);
        logger.debug("Using real access distribution" +
                     " for " + kind.toString().toLowerCase());
        return new ProbAccessDistribution(realDist, shuffler);
View Full Code Here

Examples of org.apache.commons.math3.distribution.RealDistribution

    public double density(double x) {
        if (x < min || x > max) {
            return 0d;
        }
        final int binIndex = findBin(x);
        final RealDistribution kernel = getKernel(binStats.get(binIndex));
        return kernel.density(x) * pB(binIndex) / kB(binIndex);
    }
View Full Code Here

Examples of org.apache.commons.math3.distribution.RealDistribution

        final double pBminus = pBminus(binIndex);
        final double pB = pB(binIndex);
        final double[] binBounds = getUpperBounds();
        final double kB = kB(binIndex);
        final double lower = binIndex == 0 ? min : binBounds[binIndex - 1];
        final RealDistribution kernel = k(x);
        final double withinBinCum =
            (kernel.cumulativeProbability(x) -  kernel.cumulativeProbability(lower)) / kB;
        return pBminus + pB * withinBinCum;
    }
View Full Code Here

Examples of org.apache.commons.math3.distribution.RealDistribution

        int i = 0;
        while (cumBinP(i) < p) {
            i++;
        }

        final RealDistribution kernel = getKernel(binStats.get(i));
        final double kB = kB(i);
        final double[] binBounds = getUpperBounds();
        final double lower = i == 0 ? min : binBounds[i - 1];
        final double kBminus = kernel.cumulativeProbability(lower);
        final double pB = pB(i);
        final double pBminus = pBminus(i);
        final double pCrit = p - pBminus;
        if (pCrit <= 0) {
            return lower;
        }
        return kernel.inverseCumulativeProbability(kBminus + pCrit * kB / pB);
    }
View Full Code Here

Examples of org.apache.commons.math3.distribution.RealDistribution

     * upper and lower endpoints of bin i
     */
    @SuppressWarnings("deprecation")
    private double kB(int i) {
        final double[] binBounds = getUpperBounds();
        final RealDistribution kernel = getKernel(binStats.get(i));
        return i == 0 ? kernel.cumulativeProbability(min, binBounds[0]) :
            kernel.cumulativeProbability(binBounds[i - 1], binBounds[i]);
    }
View Full Code Here

Examples of org.apache.commons.math3.distribution.RealDistribution

        }

        // Fill values array with random data from N(mu, sigma)
        // and fill valuesList with values from values array with
        // values[i] repeated weights[i] times, each i
        final RealDistribution valueDist = new NormalDistribution(mu, sigma);
        List<Double> valuesList = new ArrayList<Double>();
        for (int i = 0; i < len; i++) {
            double value = valueDist.sample();
            values[i] = value;
            for (int j = 0; j < intWeights[i]; j++) {
                valuesList.add(new Double(value));
            }
        }
View Full Code Here

Examples of org.apache.commons.math3.distribution.RealDistribution

        double[] permuted = new double[10];
        RandomDataGenerator random = new RandomDataGenerator();

        // Generate 10 distinct random values
        for (int i = 0; i < 10; i++) {
            final RealDistribution u = new UniformRealDistribution(i + 0.5, i + 0.75);
            original[i] = u.sample();
        }

        // Generate a random permutation, making sure it is not the identity
        boolean isIdentity = true;
        do {
View Full Code Here

Examples of org.apache.commons.math3.distribution.RealDistribution

*/
@Deprecated
public class PolynomialFitterTest {
    @Test
    public void testFit() {
        final RealDistribution rng = new UniformRealDistribution(-100, 100);
        rng.reseedRandomGenerator(64925784252L);

        final LevenbergMarquardtOptimizer optim = new LevenbergMarquardtOptimizer();
        final PolynomialFitter fitter = new PolynomialFitter(optim);
        final double[] coeff = { 12.9, -3.4, 2.1 }; // 12.9 - 3.4 x + 2.1 x^2
        final PolynomialFunction f = new PolynomialFunction(coeff);

        // Collect data from a known polynomial.
        for (int i = 0; i < 100; i++) {
            final double x = rng.sample();
            fitter.addObservedPoint(x, f.value(x));
        }

        // Start fit from initial guesses that are far from the optimal values.
        final double[] best = fitter.fit(new double[] { -1e-20, 3e15, -5e25 });
View Full Code Here

Examples of org.apache.commons.math3.distribution.RealDistribution

                binBounds[bin - 1];
            final double upper = binBounds[bin];
            // Compute bMinus = sum or mass of bins below the bin containing the point
            // First bin has mass 11 / 10000, the rest have mass 10 / 10000.
            final double bMinus = bin == 0 ? 0 : (bin - 1) * binMass + firstBinMass;
            final RealDistribution kernel = findKernel(lower, upper);
            final double withinBinKernelMass = kernel.cumulativeProbability(lower, upper);
            final double kernelCum = kernel.cumulativeProbability(lower, testPoints[i]);
            cumValues[i] = bMinus + (bin == 0 ? firstBinMass : binMass) * kernelCum/withinBinKernelMass;
        }
        return cumValues;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.