当前位置: 首页>>代码示例>>Java>>正文


Java PascalDistribution类代码示例

本文整理汇总了Java中org.apache.commons.math3.distribution.PascalDistribution的典型用法代码示例。如果您正苦于以下问题:Java PascalDistribution类的具体用法?Java PascalDistribution怎么用?Java PascalDistribution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PascalDistribution类属于org.apache.commons.math3.distribution包,在下文中一共展示了PascalDistribution类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNextPascal

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
@Test
public void testNextPascal() {
    PascalDistributionTest testInstance = new PascalDistributionTest();
    int[] densityPoints = testInstance.makeDensityTestPoints();
    double[] densityValues = testInstance.makeDensityTestValues();
    int sampleSize = 1000;
    int length = TestUtils.eliminateZeroMassPoints(densityPoints, densityValues);
    PascalDistribution distribution = (PascalDistribution) testInstance.makeDistribution();
    double[] expectedCounts = new double[length];
    long[] observedCounts = new long[length];
    for (int i = 0; i < length; i++) {
        expectedCounts[i] = sampleSize * densityValues[i];
    }
    randomData.reSeed(1000);
    for (int i = 0; i < sampleSize; i++) {
      int value = randomData.nextPascal(distribution.getNumberOfSuccesses(), distribution.getProbabilityOfSuccess());
      for (int j = 0; j < length; j++) {
          if (value == densityPoints[j]) {
              observedCounts[j]++;
          }
      }
    }
    TestUtils.assertChiSquareAccept(densityPoints, expectedCounts, observedCounts, .001);
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:25,代码来源:RandomDataGeneratorTest.java

示例2: CMParameters

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
/**
 * Constructs a new <code>CMParameters</code> configured from the given <code>MergeContext</code>.
 *
 * @param context
 *         the <code>MergeContext</code> to use
 */
public CMParameters(MergeContext context) {
    setNoMatchWeight(context.getWn());
    setRenamingWeight(context.getWr());
    setAncestryViolationWeight(context.getWa());
    setSiblingGroupBreakupWeight(context.getWs());
    setOrderingWeight(context.getWo());
    rng = new RandomAdaptor(context.getSeed().map(Well19937c::new).orElse(new Well19937c()));
    assignDist = new PascalDistribution(rng, 1, context.getpAssign());
    setPAssign(context.getpAssign());
    setFixLower(context.getFixLower());
    setFixUpper(context.getFixUpper());
    setBeta(30);
    setParallel(context.isCmMatcherParallel());
    setFixRandomPercentage(context.isCmMatcherFixRandomPercentage());
    lcaCache = new ConcurrentHashMap<>();
    siblingCache = new ConcurrentHashMap<>();
    otherSiblingsCache = new ConcurrentHashMap<>();
    exactContainsCache = new ConcurrentHashMap<>();
    boundContainsCache = new ConcurrentHashMap<>();
}
 
开发者ID:se-passau,项目名称:jdime,代码行数:27,代码来源:CMParameters.java

示例3: getPascal

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
@Override
public RandomNumberDistribution<Integer> getPascal(
		final RandomNumberStream rng, final Number r, final Number p)
{
	final IntegerDistribution dist = new PascalDistribution(
			RandomNumberStream.Util.asCommonsRandomGenerator(rng),
			r.intValue(), p.doubleValue());
	return new RandomNumberDistribution<Integer>()
	{
		@Override
		public Integer draw()
		{
			return dist.sample();
		}
	};
}
 
开发者ID:krevelen,项目名称:coala,代码行数:17,代码来源:RandomDistributionFactoryImpl.java

示例4: SamplingIterator

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
public SamplingIterator(RandomWrapper random, Iterator<? extends T> delegate, double samplingRate) {
  Preconditions.checkNotNull(delegate);
  Preconditions.checkArgument(samplingRate > 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;
}
 
开发者ID:saradelrio,项目名称:Chi-FRBCS-BigDataCS,代码行数:8,代码来源:SamplingIterator.java

示例5: SamplingLongPrimitiveIterator

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
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;
    doNext();
}
 
开发者ID:codelibs,项目名称:elasticsearch-taste,代码行数:13,代码来源:SamplingLongPrimitiveIterator.java

示例6: SamplingLongPrimitiveIterator

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
/**
 *
 * @param random random number generator to re-use
 * @param delegate iterator to sample from
 * @param samplingRate sampling rate in (0,1]
 */
public SamplingLongPrimitiveIterator(RandomGenerator random, LongPrimitiveIterator delegate, double samplingRate) {
  Preconditions.checkNotNull(random);
  Preconditions.checkNotNull(delegate);
  Preconditions.checkArgument(samplingRate > 0.0 && samplingRate <= 1.0);
  // Geometric distribution is special case of negative binomial (aka Pascal) with r=1:
  geometricDistribution = new PascalDistribution(random, 1, samplingRate);
  this.delegate = delegate;
  this.hasNext = true;
  doNext();
}
 
开发者ID:apsaltis,项目名称:oryx,代码行数:17,代码来源:SamplingLongPrimitiveIterator.java

示例7: SamplingLongPrimitiveIterator

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
public SamplingLongPrimitiveIterator(RandomGenerator random, LongPrimitiveIterator delegate, double samplingRate) {
  Preconditions.checkNotNull(random);
  Preconditions.checkNotNull(delegate);
  Preconditions.checkArgument(samplingRate > 0.0 && samplingRate <= 1.0);
  // Geometric distribution is special case of negative binomial (aka Pascal) with r=1:
  geometricDistribution = new PascalDistribution(random, 1, samplingRate);
  this.delegate = delegate;
  this.hasNext = true;
  doNext();
}
 
开发者ID:myrrix,项目名称:myrrix-recommender,代码行数:11,代码来源:SamplingLongPrimitiveIterator.java

示例8: nextPascal

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
/**
 * Generates a random value from the {@link PascalDistribution Pascal Distribution}.
 *
 * @param r the number of successes of the Pascal distribution
 * @param p the probability of success of the Pascal distribution
 * @return random value sampled from the Pascal(r, p) distribution
 * @throws NotStrictlyPositiveException if the number of successes is not positive
 * @throws OutOfRangeException if the probability of success is not in the
 * range {@code [0, 1]}.
 */
public int nextPascal(int r, double p) throws NotStrictlyPositiveException, OutOfRangeException {
    return new PascalDistribution(getRandomGenerator(), r, p).sample();
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:14,代码来源:RandomDataGenerator.java

示例9: nextPascal

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
/**
 * Generates a random value from the {@link PascalDistribution Pascal Distribution}.
 * This implementation uses {@link #nextInversionDeviate(IntegerDistribution) inversion}
 * to generate random values.
 *
 * @param r the number of successes of the Pascal distribution
 * @param p the probability of success of the Pascal distribution
 * @return random value sampled from the Pascal(r, p) distribution
 * @since 2.2
 */
public int nextPascal(int r, double p) {
    return nextInversionDeviate(new PascalDistribution(r, p));
}
 
开发者ID:golharam,项目名称:FastQC,代码行数:14,代码来源:RandomDataImpl.java

示例10: nextPascal

import org.apache.commons.math3.distribution.PascalDistribution; //导入依赖的package包/类
/**
 * Generates a random value from the {@link PascalDistribution Pascal Distribution}.
 *
 * @param r the number of successes of the Pascal distribution
 * @param p the probability of success of the Pascal distribution
 * @return random value sampled from the Pascal(r, p) distribution
 * @throws NotStrictlyPositiveException if the number of successes is not positive
 * @throws OutOfRangeException if the probability of success is not in the
 * range {@code [0, 1]}.
 */
public int nextPascal(int r, double p) throws NotStrictlyPositiveException, OutOfRangeException {
    return new PascalDistribution(getRan(), r, p).sample();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:RandomDataGenerator.java


注:本文中的org.apache.commons.math3.distribution.PascalDistribution类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。