本文整理了Java中org.apache.mahout.math.jet.random.Gamma.pdf()
方法的一些代码示例,展示了Gamma.pdf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gamma.pdf()
方法的具体详情如下:
包路径:org.apache.mahout.math.jet.random.Gamma
类名称:Gamma
方法名:pdf
[英]Returns the probability distribution function.
[中]返回概率分布函数。
代码示例来源:origin: apache/mahout
@Test
public void testPdf() {
Random gen = RandomUtils.getRandom();
for (double alpha : new double[]{0.01, 0.1, 1, 2, 10, 100}) {
for (double beta : new double[]{0.1, 1, 2, 100}) {
Gamma g1 = new Gamma(alpha, beta, gen);
for (double x : seq(0, 0.99, 0.1)) {
double p = Math.pow(beta, alpha) * Math.pow(x, alpha - 1) *
Math.exp(-beta * x - org.apache.mahout.math.jet.stat.Gamma.logGamma(alpha));
assertEquals(String.format(Locale.ENGLISH, "alpha=%.2f, beta=%.2f, x=%.2f\n", alpha, beta, x),
p, g1.pdf(x), 1.0e-9);
}
}
}
}
}
代码示例来源:origin: cloudera/mahout
@Test
public void testPdf() {
Random gen = RandomUtils.getRandom();
for (double alpha : new double[]{0.01, 0.1, 1, 2, 10, 100}) {
for (double beta : new double[]{0.1, 1, 2, 100}) {
Gamma g1 = new Gamma(alpha, beta, gen);
for (double x : seq(0, 0.99, 0.1)) {
double p = Math.pow(beta, alpha) * Math.pow(x, alpha - 1) *
Math.exp(-beta * x - org.apache.mahout.math.jet.stat.Gamma.logGamma(alpha));
assertEquals(String.format(Locale.ENGLISH, "alpha=%.2f, beta=%.2f, x=%.2f\n", alpha, beta, x),
p, g1.pdf(x), 1.0e-9);
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!