org.apache.mahout.math.jet.random.Gamma.pdf()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(175)

本文整理了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

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);
    }
   }
  }
 }
}

相关文章