本文整理了Java中org.apache.mahout.math.jet.random.Gamma.logGamma()
方法的一些代码示例,展示了Gamma.logGamma()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gamma.logGamma()
方法的具体详情如下:
包路径:org.apache.mahout.math.jet.random.Gamma
类名称:Gamma
方法名:logGamma
[英]Returns a quick approximation of log(gamma(x)).
[中]返回对数(gamma(x))的快速近似值。
代码示例来源:origin: apache/mahout
/** Returns the probability distribution function.
* @param x Where to compute the density function.
*
* @return The value of the gamma density at x.
*/
@Override
public double pdf(double x) {
if (x < 0) {
throw new IllegalArgumentException();
}
if (x == 0) {
if (alpha == 1.0) {
return rate;
} else if (alpha < 1) {
return Double.POSITIVE_INFINITY;
} else {
return 0;
}
}
if (alpha == 1.0) {
return rate * Math.exp(-x * rate);
}
return rate * Math.exp((alpha - 1.0) * Math.log(x * rate) - x * rate - logGamma(alpha));
}
代码示例来源:origin: cloudera/mahout
/** Returns the probability distribution function.
* @param x Where to compute the density function.
*
* @return The value of the gamma density at x.
*/
@Override
public double pdf(double x) {
if (x < 0) {
throw new IllegalArgumentException();
}
if (x == 0) {
if (alpha == 1.0) {
return rate;
} else if (alpha < 1) {
return Double.POSITIVE_INFINITY;
} else {
return 0;
}
}
if (alpha == 1.0) {
return rate * Math.exp(-x * rate);
}
return rate * Math.exp((alpha - 1.0) * Math.log(x * rate) - x * rate - logGamma(alpha));
}
代码示例来源:origin: org.apache.mahout/mahout-math
/** Returns the probability distribution function.
* @param x Where to compute the density function.
*
* @return The value of the gamma density at x.
*/
@Override
public double pdf(double x) {
if (x < 0) {
throw new IllegalArgumentException();
}
if (x == 0) {
if (alpha == 1.0) {
return rate;
} else if (alpha < 1) {
return Double.POSITIVE_INFINITY;
} else {
return 0;
}
}
if (alpha == 1.0) {
return rate * Math.exp(-x * rate);
}
return rate * Math.exp((alpha - 1.0) * Math.log(x * rate) - x * rate - logGamma(alpha));
}
内容来源于网络,如有侵权,请联系作者删除!