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


Java Poisson类代码示例

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


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

示例1: logPdf

import dr.math.Poisson; //导入依赖的package包/类
public static double logPdf(double x, double mean) {
    PoissonDistributionImpl dist = new PoissonDistributionImpl(mean);
    double pdf = dist.probability(x);
    if (pdf == 0 || Double.isNaN(pdf)) { // bad estimate
        return x * Math.log(mean) - Poisson.gammln(x + 1) - mean;
    }
    return Math.log(pdf);

}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:10,代码来源:PoissonDistribution.java

示例2: mutate

import dr.math.Poisson; //导入依赖的package包/类
public Mutation[] mutate(byte[] sequence, byte[] childSequence) {

		if (genomeLength != sequence.length) {
			genomeLength = sequence.length;
			poissonMean = genomeLength * muRate;
		}

		int mutationCount = Poisson.nextPoisson(poissonMean);
		Mutation[] mutations = new Mutation[mutationCount];

		System.arraycopy(sequence, 0, childSequence, 0, genomeLength);

		byte newState;
		for (int i = 0; i < mutationCount; i++) {
			int pos = MathUtils.nextInt(genomeLength);

			newState = (byte)MathUtils.nextInt(stateSize-1);
			if (newState == sequence[i]) {
				newState = (byte)((newState + 1) % stateSize);
			}

			childSequence[pos] = newState;
			mutations[i] = new Mutation(pos, newState);
		}
		return mutations;
	}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:27,代码来源:SimpleMutator.java

示例3: mutate

import dr.math.Poisson; //导入依赖的package包/类
public Mutation[] mutate(byte[] sequence, byte[] childSequence) {

		if (genomeLength != sequence.length) {
			genomeLength = sequence.length;
			poissonMean = genomeLength * muRate;
		}

		int mutationCount = Poisson.nextPoisson(poissonMean);
		Mutation[] mutations = new Mutation[mutationCount];

		System.arraycopy(sequence, 0, childSequence, 0, genomeLength);

		for (int i = 0; i < mutationCount; i++) {
			int pos = MathUtils.nextInt(genomeLength);
			byte state = (byte)((sequence[pos] + 1) % 2);
			childSequence[pos] = state;
			mutations[i] = new Mutation(pos, state);
		}
		return mutations;
	}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:21,代码来源:BinaryMutator.java

示例4: generatePartition

import dr.math.Poisson; //导入依赖的package包/类
public double[] generatePartition() {
    int lengthDividedByTwo = (getNumberOfPartitionsMinusOne() + 1) / 2;

    int value = 0;

    while (value < 1 || value > lengthDividedByTwo) {
        value = Poisson.nextPoisson(mean);
    }

    int[] x = new int[getNumberOfPartitionsMinusOne() + 1];

    for (int i = 0; i < value; i++) {
        x[i] = 1;
    }

    MathUtils.permute(x);

    if (x[0] == 1) {
        for (int i = 0; i < x.length; i++) {
            if (x[i] == 1) {
                x[i] = 0;
            } else {
                x[i] = 1;
            }
        }
    }

    double[] rValue = new double[x.length];

    for (int i = 0; i < rValue.length; i++) {
        rValue[i] = x[i];
    }

    return rValue;
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:36,代码来源:PoissonPartitionLikelihood.java

示例5: smoothPoissonOnly

import dr.math.Poisson; //导入依赖的package包/类
private static double[] smoothPoissonOnly(final double[] c, final double[] t, final boolean sample) {
    final double[] smoothed = new double[c.length];

    final double lambda = fitLambda(c, t);

    for (int i = 0; i < c.length; i++) {
        if (sample) {
            smoothed[i] = Poisson.nextPoisson(lambda * t[i]);
        } else {
            smoothed[i] = lambda;
        }
    }

    return smoothed;
}
 
开发者ID:cmccoy,项目名称:startreerenaissance,代码行数:16,代码来源:TLambdaPoissonSmoother.java

示例6: logPdf

import dr.math.Poisson; //导入依赖的package包/类
public double logPdf(double x) {

        double pdf = distribution.probability(x);
        if (pdf == 0 || Double.isNaN(pdf)) { // bad estimate
            final double mean = mean();
            return x * Math.log(mean) - Poisson.gammln(x + 1) - mean;
        }
        return Math.log(pdf);

    }
 
开发者ID:whdc,项目名称:ieo-beast,代码行数:11,代码来源:PoissonDistribution.java


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