本文整理了Java中de.lmu.ifi.dbs.elki.math.statistics.distribution.Distribution.toString()
方法的一些代码示例,展示了Distribution.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Distribution.toString()
方法的具体详情如下:
包路径:de.lmu.ifi.dbs.elki.math.statistics.distribution.Distribution
类名称:Distribution
方法名:toString
[英]Describe the distribution
[中]描述分布情况
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-core-math
/**
* Test the quality of a fit.
*
* @param x Input data
* @param test Scratch space for testing (will be overwritten!)
* @param dist Distribution
* @return K-S-Test score
* @throws ArithmeticException
*/
private static double testFit(double[] x, double[] test, Distribution dist) throws ArithmeticException {
for(int i = 0; i < test.length; i++) {
double v = dist.cdf(x[i]);
if(Double.isNaN(v)) {
throw new ArithmeticException("Got NaN after fitting " + dist.toString());
}
test[i] = (v >= 1.) ? 1 : (v <= 0.) ? 0. : v;
}
Arrays.sort(test); // Supposedly not necessary, but to be safe.
return KolmogorovSmirnovTest.simpleTest(test);
}
代码示例来源:origin: elki-project/elki
/**
* Test the quality of a fit.
*
* @param x Input data
* @param test Scratch space for testing (will be overwritten!)
* @param dist Distribution
* @return K-S-Test score
* @throws ArithmeticException
*/
private static double testFit(double[] x, double[] test, Distribution dist) throws ArithmeticException {
for(int i = 0; i < test.length; i++) {
double v = dist.cdf(x[i]);
if(Double.isNaN(v)) {
throw new ArithmeticException("Got NaN after fitting " + dist.toString());
}
test[i] = (v >= 1.) ? 1 : (v <= 0.) ? 0. : v;
}
Arrays.sort(test); // Supposedly not necessary, but to be safe.
return KolmogorovSmirnovTest.simpleTest(test);
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
/**
* Test the quality of a fit.
*
* @param x Input data
* @param test Scratch space for testing (will be overwritten!)
* @param dist Distribution
* @return K-S-Test score
* @throws ArithmeticException
*/
private double testFit(double[] x, double[] test, Distribution dist) throws ArithmeticException {
for(int i = 0; i < test.length; i++) {
test[i] = dist.cdf(x[i]);
if(test[i] > 1.) {
test[i] = 1.;
}
if(test[i] < 0.) {
test[i] = 0.;
}
if(Double.isNaN(test[i])) {
throw new ArithmeticException("Got NaN after fitting " + dist.toString());
}
}
// Should actually be sorted already...
Arrays.sort(test);
return KolmogorovSmirnovTest.simpleTest(test);
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-core-math
/**
* Test the goodness of fit, keep the best.
*
* @param est Estimator
* @param d Distribution
*/
public void test(DistributionEstimator<?> est, Distribution d) {
double score = testFit(x, scratch, d);
if(LOG.isDebuggingFine()) {
LOG.debugFine(est.getClass().getSimpleName() + ": " + score + " " + d.toString());
}
if(score < this.score) {
this.dist = d;
this.score = score;
this.est = est;
}
}
}
代码示例来源:origin: elki-project/elki
/**
* Test the goodness of fit, keep the best.
*
* @param est Estimator
* @param d Distribution
*/
public void test(DistributionEstimator<?> est, Distribution d) {
double score = testFit(x, scratch, d);
if(LOG.isDebuggingFine()) {
LOG.debugFine(est.getClass().getSimpleName() + ": " + score + " " + d.toString());
}
if(score < this.score) {
this.dist = d;
this.score = score;
this.est = est;
}
}
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
test[i] = dist.cdf(col.get(i).doubleValue(d));
if(Double.isNaN(test[i])) {
LOG.warning("Got NaN after fitting " + est.toString() + ": " + dist.toString());
continue trials;
LOG.warning("Got infinite value after fitting " + est.toString() + ": " + dist.toString());
continue trials;
double q = KolmogorovSmirnovTest.simpleTest(test);
if(LOG.isVeryVerbose()) {
LOG.veryverbose("Estimator " + est.toString() + " (" + dist.toString() + ") has maximum deviation " + q + " for dimension " + d);
LOG.verbose("Best fit for dimension " + d + ": " + best.toString());
代码示例来源:origin: elki-project/elki
test[i] = dist.cdf(col.get(i).doubleValue(d));
if(Double.isNaN(test[i])) {
LOG.warning("Got NaN after fitting " + est.toString() + ": " + dist.toString());
continue trials;
LOG.warning("Got infinite value after fitting " + est.toString() + ": " + dist.toString());
continue trials;
double q = KolmogorovSmirnovTest.simpleTest(test);
if(LOG.isVeryVerbose()) {
LOG.veryverbose("Estimator " + est.toString() + " (" + dist.toString() + ") has maximum deviation " + q + " for dimension " + d);
LOG.verbose("Best fit for dimension " + d + ": " + best.toString());
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
test[i] = dist.cdf(castColumn.get(i).doubleValue(d));
if(Double.isNaN(test[i])) {
LOG.warning("Got NaN after fitting " + est.toString() + ": " + dist.toString());
continue trials;
LOG.warning("Got infinite value after fitting " + est.toString() + ": " + dist.toString());
continue trials;
double q = KolmogorovSmirnovTest.simpleTest(test);
if(LOG.isVeryVerbose()) {
LOG.veryverbose("Estimator " + est.toString() + " (" + dist.toString() + ") has maximum deviation " + q + " for dimension " + d);
LOG.verbose("Best fit for dimension " + d + ": " + best.toString());
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
for(int i = 0; i < cursclus.getDim(); i++) {
Distribution gen = cursclus.getDistribution(i);
outStream.append("## ").append(gen.toString()).append(LINE_SEPARATOR);
代码示例来源:origin: elki-project/elki
for(int i = 0; i < cursclus.getDim(); i++) {
Distribution gen = cursclus.getDistribution(i);
outStream.append("## ").append(gen.toString()).append(LINE_SEPARATOR);
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-data-generator
for(int i = 0; i < cursclus.getDim(); i++) {
Distribution gen = cursclus.getDistribution(i);
outStream.append("## ").append(gen.toString()).append(LINE_SEPARATOR);
代码示例来源:origin: elki-project/elki
Distribution dist = findBestFit(castColumn, adapter, d, test);
if(LOG.isVerbose()) {
LOG.verbose("Best fit for dimension " + d + ": " + dist.toString());
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-input
Distribution dist = findBestFit(castColumn, adapter, d, test);
if(LOG.isVerbose()) {
LOG.verbose("Best fit for dimension " + d + ": " + dist.toString());
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
double score = testFit(x, scratch, d);
if(LOG.isDebuggingFine()) {
LOG.debugFine(est.getClass().getSimpleName() + ": " + score + " " + d.toString());
double score = testFit(x, scratch, d);
if(LOG.isDebuggingFine()) {
LOG.debugFine(est.getClass().getSimpleName() + ": " + score + " " + d.toString());
double score = testFit(x, scratch, d);
if(LOG.isDebuggingFine()) {
LOG.debugFine(est.getClass().getSimpleName() + ": " + score + " " + d.toString());
double score = testFit(x, scratch, d);
if(LOG.isDebuggingFine()) {
LOG.debugFine(est.getClass().getSimpleName() + ": " + score + " " + d.toString());
double score = testFit(x, scratch, d);
if(LOG.isDebuggingFine()) {
LOG.debugFine(est.getClass().getSimpleName() + ": " + score + " " + d.toString());
double score = testFit(x, scratch, d);
if(LOG.isDebuggingFine()) {
LOG.debugFine(est.getClass().getSimpleName() + ": " + score + " " + d.toString());
double score = testFit(x, scratch, d);
if(LOG.isDebuggingFine()) {
LOG.debugFine(est.getClass().getSimpleName() + ": " + score + " " + d.toString());
LOG.veryverbose("Best distribution fit: " + bestscore + " " + best.toString() + " via " + bestest);
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!