本文整理汇总了Java中org.apache.commons.math.stat.descriptive.SummaryStatistics.getStandardDeviation方法的典型用法代码示例。如果您正苦于以下问题:Java SummaryStatistics.getStandardDeviation方法的具体用法?Java SummaryStatistics.getStandardDeviation怎么用?Java SummaryStatistics.getStandardDeviation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math.stat.descriptive.SummaryStatistics
的用法示例。
在下文中一共展示了SummaryStatistics.getStandardDeviation方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNextValue
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/**
* Generates a random value from this distribution.
*
* @return the random value.
* @throws IllegalStateException if the distribution has not been loaded
*/
public double getNextValue() throws IllegalStateException {
if (!loaded) {
throw new IllegalStateException("distribution not loaded");
}
// Start with a uniformly distributed random number in (0,1)
double x = Math.random();
// Use this to select the bin and generate a Gaussian within the bin
for (int i = 0; i < binCount; i++) {
if (x <= upperBounds[i]) {
SummaryStatistics stats = (SummaryStatistics)binStats.get(i);
if (stats.getN() > 0) {
if (stats.getStandardDeviation() > 0) { // more than one obs
return randomData.nextGaussian
(stats.getMean(),stats.getStandardDeviation());
} else {
return stats.getMean(); // only one obs in bin
}
}
}
}
throw new RuntimeException("No bin selected");
}
示例2: testNextGaussian
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/** test failure modes and distribution of nextGaussian() */
public void testNextGaussian() {
try {
randomData.nextGaussian(0,0);
fail("zero sigma -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
;
}
SummaryStatistics u = new SummaryStatistics();
for (int i = 0; i<largeSampleSize; i++) {
u.addValue(randomData.nextGaussian(0,1));
}
double xbar = u.getMean();
double s = u.getStandardDeviation();
double n = (double) u.getN();
/* t-test at .001-level TODO: replace with externalized t-test, with
* test statistic defined in TestStatistic
*/
assertTrue(Math.abs(xbar)/(s/Math.sqrt(n))< 3.29);
}
示例3: analyseImage
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
@Override
public void analyseImage(FImage image) {
final FImage limg = image.process(laplacian);
final FImage aimg = image.process(average);
final SummaryStatistics stats = new SummaryStatistics();
for (int r = 0; r < limg.height; r++) {
for (int c = 0; c < limg.width; c++) {
if (mask != null && mask.pixels[r][c] == 0)
continue;
if (aimg.pixels[r][c] != 0) {
stats.addValue(Math.abs(limg.pixels[r][c] / aimg.pixels[r][c]));
}
}
}
sharpnessVariation = stats.getStandardDeviation();
}
示例4: testNextGaussian
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/** test failure modes and distribution of nextGaussian() */
public void testNextGaussian() {
try {
randomData.nextGaussian(0, 0);
fail("zero sigma -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// ignored
}
SummaryStatistics u = new SummaryStatistics();
for (int i = 0; i < largeSampleSize; i++) {
u.addValue(randomData.nextGaussian(0, 1));
}
double xbar = u.getMean();
double s = u.getStandardDeviation();
double n = u.getN();
/*
* t-test at .001-level TODO: replace with externalized t-test, with
* test statistic defined in TestStatistic
*/
assertTrue(Math.abs(xbar) / (s / Math.sqrt(n)) < 3.29);
}
示例5: testNextGaussian
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/** test failure modes and distribution of nextGaussian() */
public void testNextGaussian() {
try {
randomData.nextGaussian(0, 0);
fail("zero sigma -- IllegalArgumentException expected");
} catch (IllegalArgumentException ex) {
// ignored
}
SummaryStatistics u = new SummaryStatistics();
for (int i = 0; i < largeSampleSize; i++) {
u.addValue(randomData.nextGaussian(0, 1));
}
double xbar = u.getMean();
double s = u.getStandardDeviation();
double n = u.getN();
/*
* t-test at .001-level TODO: replace with externalized t-test, with
* test statistic defined in TestStatistic
*/
assertTrue(Math.abs(xbar) / (s / Math.sqrt(n)) < 3.29);
}
示例6: getNextValue
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/**
* Generates a random value from this distribution.
*
* @return the random value.
* @throws IllegalStateException if the distribution has not been loaded
*/
public double getNextValue() throws IllegalStateException {
if (!loaded) {
throw MathRuntimeException.createIllegalStateException(LocalizedFormats.DISTRIBUTION_NOT_LOADED);
}
// Start with a uniformly distributed random number in (0,1)
double x = FastMath.random();
// Use this to select the bin and generate a Gaussian within the bin
for (int i = 0; i < binCount; i++) {
if (x <= upperBounds[i]) {
SummaryStatistics stats = binStats.get(i);
if (stats.getN() > 0) {
if (stats.getStandardDeviation() > 0) { // more than one obs
return randomData.nextGaussian
(stats.getMean(),stats.getStandardDeviation());
} else {
return stats.getMean(); // only one obs in bin
}
}
}
}
throw new MathRuntimeException(LocalizedFormats.NO_BIN_SELECTED);
}
示例7: testNextGaussian
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/** test failure modes and distribution of nextGaussian() */
public void testNextGaussian() {
try {
randomData.nextGaussian(0, 0);
fail("zero sigma -- MathIllegalArgumentException expected");
} catch (MathIllegalArgumentException ex) {
// ignored
}
SummaryStatistics u = new SummaryStatistics();
for (int i = 0; i < largeSampleSize; i++) {
u.addValue(randomData.nextGaussian(0, 1));
}
double xbar = u.getMean();
double s = u.getStandardDeviation();
double n = u.getN();
/*
* t-test at .001-level TODO: replace with externalized t-test, with
* test statistic defined in TestStatistic
*/
assertTrue(FastMath.abs(xbar) / (s / FastMath.sqrt(n)) < 3.29);
}
示例8: getNextValue
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/**
* Generates a random value from this distribution.
*
* @return the random value.
* @throws IllegalStateException if the distribution has not been loaded
*/
public double getNextValue() throws IllegalStateException {
if (!loaded) {
throw MathRuntimeException.createIllegalStateException(LocalizedFormats.DISTRIBUTION_NOT_LOADED);
}
// Start with a uniformly distributed random number in (0,1)
double x = randomData.nextUniform(0,1);
// Use this to select the bin and generate a Gaussian within the bin
for (int i = 0; i < binCount; i++) {
if (x <= upperBounds[i]) {
SummaryStatistics stats = binStats.get(i);
if (stats.getN() > 0) {
if (stats.getStandardDeviation() > 0) { // more than one obs
return randomData.nextGaussian
(stats.getMean(),stats.getStandardDeviation());
} else {
return stats.getMean(); // only one obs in bin
}
}
}
}
throw new MathRuntimeException(LocalizedFormats.NO_BIN_SELECTED);
}
示例9: testNextGaussian
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/** test failure modes and distribution of nextGaussian() */
@Test
public void testNextGaussian() {
try {
randomData.nextGaussian(0, 0);
Assert.fail("zero sigma -- MathIllegalArgumentException expected");
} catch (MathIllegalArgumentException ex) {
// ignored
}
SummaryStatistics u = new SummaryStatistics();
for (int i = 0; i < largeSampleSize; i++) {
u.addValue(randomData.nextGaussian(0, 1));
}
double xbar = u.getMean();
double s = u.getStandardDeviation();
double n = u.getN();
/*
* t-test at .001-level TODO: replace with externalized t-test, with
* test statistic defined in TestStatistic
*/
Assert.assertTrue(FastMath.abs(xbar) / (s / FastMath.sqrt(n)) < 3.29);
}
示例10: getNextValue
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/**
* Generates a random value from this distribution.
*
* @return the random value.
* @throws IllegalStateException if the distribution has not been loaded
*/
public double getNextValue() throws IllegalStateException {
if (!loaded) {
throw MathRuntimeException.createIllegalStateException("distribution not loaded");
}
// Start with a uniformly distributed random number in (0,1)
double x = Math.random();
// Use this to select the bin and generate a Gaussian within the bin
for (int i = 0; i < binCount; i++) {
if (x <= upperBounds[i]) {
SummaryStatistics stats = binStats.get(i);
if (stats.getN() > 0) {
if (stats.getStandardDeviation() > 0) { // more than one obs
return randomData.nextGaussian
(stats.getMean(),stats.getStandardDeviation());
} else {
return stats.getMean(); // only one obs in bin
}
}
}
}
throw new MathRuntimeException("no bin selected");
}
示例11: getNextValue
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
/**
* Generates a random value from this distribution.
*
* @return the random value.
* @throws IllegalStateException if the distribution has not been loaded
*/
public double getNextValue() throws IllegalStateException {
if (!loaded) {
throw MathRuntimeException.createIllegalStateException("distribution not loaded");
}
// Start with a uniformly distributed random number in (0,1)
double x = Math.random();
// Use this to select the bin and generate a Gaussian within the bin
for (int i = 0; i < binCount; i++) {
if (x <= upperBounds[i]) {
SummaryStatistics stats = binStats.get(i);
if (stats.getN() > 0) {
if (stats.getStandardDeviation() > 0) { // more than one obs
return randomData.nextGaussian
(stats.getMean(),stats.getStandardDeviation());
} else {
return stats.getMean(); // only one obs in bin
}
}
}
}
throw new MathRuntimeException("no bin selected");
}
示例12: getValueFromSummaryStatistics
import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
double getValueFromSummaryStatistics(SummaryStatistics summaryStatistics) {
return summaryStatistics.getN()==0 ? 0 : summaryStatistics.getStandardDeviation();
}