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

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

本文整理了Java中org.apache.mahout.math.jet.random.Gamma.randomDouble()方法的一些代码示例,展示了Gamma.randomDouble()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Gamma.randomDouble()方法的具体详情如下:
包路径:org.apache.mahout.math.jet.random.Gamma
类名称:Gamma
方法名:randomDouble

Gamma.randomDouble介绍

暂无

代码示例

代码示例来源:origin: apache/mahout

b = 1.0 + 0.36788794412 * alpha;              // Step 1
while (true) {
 double p = b * randomDouble();
 if (p <= 1.0) {                       // Step 2. Case gds <= 1
  gds = Math.exp(Math.log(p) / alpha);
  if (Math.log(randomDouble()) <= -gds) {
   return gds / rate;
  if (Math.log(randomDouble()) <= (alpha - 1.0) * Math.log(gds)) {
   return gds / rate;
double v1;
do {
 v1 = 2.0 * randomDouble() - 1.0;
 double v2 = 2.0 * randomDouble() - 1.0;
 v12 = v1 * v1 + v2 * v2;
} while (v12 > 1.0);
double u = randomDouble();
if (d * u <= t * t * t) {
 return gds / rate;
 double e;
 do {
  e = -Math.log(randomDouble());
  u = randomDouble();
  u = u + u - 1.0;
  sign_u = u > 0 ? 1.0 : -1.0;

代码示例来源:origin: cloudera/mahout

b = 1.0 + 0.36788794412 * alpha;              // Step 1
while (true) {
 double p = b * randomDouble();
 if (p <= 1.0) {                       // Step 2. Case gds <= 1
  gds = Math.exp(Math.log(p) / alpha);
  if (Math.log(randomDouble()) <= -gds) {
   return gds / rate;
  if (Math.log(randomDouble()) <= (alpha - 1.0) * Math.log(gds)) {
   return gds / rate;
double v1;
do {
 v1 = 2.0 * randomDouble() - 1.0;
 double v2 = 2.0 * randomDouble() - 1.0;
 v12 = v1 * v1 + v2 * v2;
} while (v12 > 1.0);
double u = randomDouble();
if (d * u <= t * t * t) {
 return gds / rate;
 double e;
 do {
  e = -Math.log(randomDouble());
  u = randomDouble();
  u = u + u - 1.0;
  sign_u = u > 0 ? 1.0 : -1.0;

代码示例来源:origin: org.apache.mahout/mahout-math

b = 1.0 + 0.36788794412 * alpha;              // Step 1
while (true) {
 double p = b * randomDouble();
 if (p <= 1.0) {                       // Step 2. Case gds <= 1
  gds = Math.exp(Math.log(p) / alpha);
  if (Math.log(randomDouble()) <= -gds) {
   return gds / rate;
  if (Math.log(randomDouble()) <= (alpha - 1.0) * Math.log(gds)) {
   return gds / rate;
double v1;
do {
 v1 = 2.0 * randomDouble() - 1.0;
 double v2 = 2.0 * randomDouble() - 1.0;
 v12 = v1 * v1 + v2 * v2;
} while (v12 > 1.0);
double u = randomDouble();
if (d * u <= t * t * t) {
 return gds / rate;
 double e;
 do {
  e = -Math.log(randomDouble());
  u = randomDouble();
  u = u + u - 1.0;
  sign_u = u > 0 ? 1.0 : -1.0;

相关文章