de.lmu.ifi.dbs.elki.math.statistics.distribution.Distribution.pdf()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(108)

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

Distribution.pdf介绍

[英]Return the density of an existing value
[中]返回现有值的密度

代码示例

代码示例来源:origin: elki-project/elki

/**
 * Compute density for cluster model at given double[] p-
 *
 * @see GeneratorInterface#getDensity(double[])
 */
@Override
public double getDensity(double[] p) {
 if(trans != null) {
  p = trans.applyInverse(p);
 }
 double density = densitycorrection;
 for(int i = 0; i < dim; i++) {
  density *= axes.get(i).pdf(p[i]);
 }
 return density;
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-data-generator

/**
 * Compute density for cluster model at given double[] p-
 *
 * @see GeneratorInterface#getDensity(double[])
 */
@Override
public double getDensity(double[] p) {
 if(trans != null) {
  p = trans.applyInverse(p);
 }
 double density = densitycorrection;
 for(int i = 0; i < dim; i++) {
  density *= axes.get(i).pdf(p[i]);
 }
 return density;
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

/**
 * Compute density for cluster model at given vector p-
 * 
 * @see de.lmu.ifi.dbs.elki.data.synthetic.bymodel.GeneratorInterface#getDensity(de.lmu.ifi.dbs.elki.math.linearalgebra.Vector)
 */
@Override
public double getDensity(Vector p) {
 Vector o = p;
 if(trans != null) {
  o = trans.applyInverse(p);
 }
 double density = 1.0;
 int i = 0;
 for(Distribution axis : axes) {
  density = density * axis.pdf(o.get(i));
  i++;
 }
 return density * densitycorrection;
}

代码示例来源:origin: elki-project/elki

public void checkPDF(Distribution d, String key, double err) {
 // Also check that toString is meaningful.
 assertEquals("No meaningful toString()", -1, d.toString().indexOf('@'));
 double[] data = this.data.get(key);
 assertNotNull("Key not in test data: " + key, data);
 assertEquals("Not NaN for NaN", Double.NaN, d.pdf(Double.NaN), 0.);
 assertEquals("Not zero at neginf", 0., d.pdf(Double.NEGATIVE_INFINITY), 0.);
 assertEquals("Not zero at almost neginf", 0., d.pdf(-Double.MAX_VALUE), 0.);
 assertEquals("Not zero at posinf", 0., d.pdf(Double.POSITIVE_INFINITY), 0.);
 assertEquals("Not zero at almost posinf", 0., d.pdf(Double.MAX_VALUE), 0.);
 int maxerrlev = -15;
 for(int i = 0; i < data.length;) {
  double x = data[i++], exp = data[i++];
  double val = d.pdf(x);
  if(val == exp) {
   continue;
  }
  double diff = Math.abs(val - exp);
  final int errlev = (int) Math.ceil(Math.log10(diff / exp));
  maxerrlev = Math.max(errlev, maxerrlev);
  if(diff < err || diff / exp < err) {
   continue;
  }
  assertEquals("Error magnitude: 1e" + errlev + " at " + x, exp, val, err);
 }
 int given = (int) Math.floor(Math.log10(err * 1.1));
 assertTrue("Error magnitude is not tight: measured " + maxerrlev + " specified " + given, given <= maxerrlev);
}

相关文章