当前位置: 首页>>代码示例>>Java>>正文


Java SummaryStatistics.addValue方法代码示例

本文整理汇总了Java中org.apache.commons.math.stat.descriptive.SummaryStatistics.addValue方法的典型用法代码示例。如果您正苦于以下问题:Java SummaryStatistics.addValue方法的具体用法?Java SummaryStatistics.addValue怎么用?Java SummaryStatistics.addValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math.stat.descriptive.SummaryStatistics的用法示例。


在下文中一共展示了SummaryStatistics.addValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getClassToObject

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
private SummaryStatistics getClassToObject() {
		SummaryStatistics summary = new SummaryStatistics();
		HashSet<String> classNameSet = new HashSet<String>();
		for (GraphMetricItem gmi : listOfObjects.values()) {
			// HACK: displayTypeName is not uniquely identified
			// HACK: using gmi.declaredTypeName is a workaround, but some
			// declared types are imprecise. See Hashtable<K, List<V>> in PX
			classNameSet.add(gmi.declaredTypeName);
		}
		
		// System.out.println("classes that have more than one representative in the object graph");

		for (String className : classNameSet) {
			long count = 0;
			for (GraphMetricItem gmj : listOfObjects.values()) {
				if (gmj.declaredTypeName.equals(className)){
					count++;
//					if (count>1)
//					 System.out.println(gmj.declaredTypeName);
				}
			}
			summary.addValue(count);
		}
		return summary;
	}
 
开发者ID:aroog,项目名称:code,代码行数:26,代码来源:OOGMetricsReport.java

示例2: computeStatistics

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
public static SummaryStatistics computeStatistics(UnexpectednessScorer scorer) {
	int numNodes = scorer.graph.numNodes();
	SummaryStatistics stats = new SummaryStatistics();
	
	ProgressLogger pl = new ProgressLogger(LOGGER, "docs");
	pl.expectedUpdates = numNodes;
	pl.start("Finding statistics for values of " + scorer + "...");

	for (int i = 0; i < numNodes; i++) {
		for (double x : scorer.scores(i).values()) {
			stats.addValue(x);
			if (Double.isInfinite(x) || Double.isNaN(x))
				throw new ArithmeticException(
						"Scorer " + scorer + " has returned value "
						+ x + " for a result of document " + i);
		}
		pl.lightUpdate();
	}
	pl.done();
	
	return stats;
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:23,代码来源:ScorerStatisticsSummarizer.java

示例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();
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:20,代码来源:SharpnessVariation.java

示例4: testTwoSampleTHomoscedastic

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
public void testTwoSampleTHomoscedastic() throws Exception {
    double[] sample1 ={2, 4, 6, 8, 10, 97};
    double[] sample2 = {4, 6, 8, 10, 16};
    SummaryStatistics sampleStats1 = new SummaryStatistics();  
    for (int i = 0; i < sample1.length; i++) {
        sampleStats1.addValue(sample1[i]);
    }
    SummaryStatistics sampleStats2 = new SummaryStatistics();    
    for (int i = 0; i < sample2.length; i++) {
        sampleStats2.addValue(sample2[i]);
    }
    
    // Target comparison values computed using R version 1.8.1 (Linux version)
    assertEquals("two sample homoscedastic t stat", 0.73096310086, 
            TestUtils.homoscedasticT(sample1, sample2), 10E-11);
    assertEquals("two sample homoscedastic p value", 0.4833963785, 
            TestUtils.homoscedasticTTest(sampleStats1, sampleStats2), 1E-10);     
    assertTrue("two sample homoscedastic t-test reject", 
            TestUtils.homoscedasticTTest(sample1, sample2, 0.49));
    assertTrue("two sample homoscedastic t-test accept", 
            !TestUtils.homoscedasticTTest(sample1, sample2, 0.48));
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:23,代码来源:TestUtilsTest.java

示例5: testTwoSampleTHomoscedastic

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
public void testTwoSampleTHomoscedastic() throws Exception {
    double[] sample1 ={2, 4, 6, 8, 10, 97};
    double[] sample2 = {4, 6, 8, 10, 16};
    SummaryStatistics sampleStats1 = new SummaryStatistics();  
    for (int i = 0; i < sample1.length; i++) {
        sampleStats1.addValue(sample1[i]);
    }
    SummaryStatistics sampleStats2 = new SummaryStatistics();    
    for (int i = 0; i < sample2.length; i++) {
        sampleStats2.addValue(sample2[i]);
    }
    
    // Target comparison values computed using R version 1.8.1 (Linux version)
    assertEquals("two sample homoscedastic t stat", 0.73096310086, 
          testStatistic.homoscedasticT(sample1, sample2), 10E-11);
    assertEquals("two sample homoscedastic p value", 0.4833963785, 
            testStatistic.homoscedasticTTest(sampleStats1, sampleStats2), 1E-10);     
    assertTrue("two sample homoscedastic t-test reject", 
            testStatistic.homoscedasticTTest(sample1, sample2, 0.49));
    assertTrue("two sample homoscedastic t-test accept", 
            !testStatistic.homoscedasticTTest(sample1, sample2, 0.48));
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:23,代码来源:TTestTest.java

示例6: 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);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:21,代码来源:RandomDataTest.java

示例7: testTwoSampleTHomoscedastic

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
public void testTwoSampleTHomoscedastic() throws Exception {
    double[] sample1 ={2, 4, 6, 8, 10, 97};
    double[] sample2 = {4, 6, 8, 10, 16};
    SummaryStatistics sampleStats1 = new SummaryStatistics();
    for (int i = 0; i < sample1.length; i++) {
        sampleStats1.addValue(sample1[i]);
    }
    SummaryStatistics sampleStats2 = new SummaryStatistics();
    for (int i = 0; i < sample2.length; i++) {
        sampleStats2.addValue(sample2[i]);
    }

    // Target comparison values computed using R version 1.8.1 (Linux version)
    assertEquals("two sample homoscedastic t stat", 0.73096310086,
          testStatistic.homoscedasticT(sample1, sample2), 10E-11);
    assertEquals("two sample homoscedastic p value", 0.4833963785,
            testStatistic.homoscedasticTTest(sampleStats1, sampleStats2), 1E-10);
    assertTrue("two sample homoscedastic t-test reject",
            testStatistic.homoscedasticTTest(sample1, sample2, 0.49));
    assertTrue("two sample homoscedastic t-test accept",
            !testStatistic.homoscedasticTTest(sample1, sample2, 0.48));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:23,代码来源:TTestTest.java

示例8: testTwoSampleTHomoscedastic

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
public void testTwoSampleTHomoscedastic() throws Exception {
    double[] sample1 ={2, 4, 6, 8, 10, 97};
    double[] sample2 = {4, 6, 8, 10, 16};
    SummaryStatistics sampleStats1 = new SummaryStatistics();
    for (int i = 0; i < sample1.length; i++) {
        sampleStats1.addValue(sample1[i]);
    }
    SummaryStatistics sampleStats2 = new SummaryStatistics();
    for (int i = 0; i < sample2.length; i++) {
        sampleStats2.addValue(sample2[i]);
    }

    // Target comparison values computed using R version 1.8.1 (Linux version)
    assertEquals("two sample homoscedastic t stat", 0.73096310086,
            TestUtils.homoscedasticT(sample1, sample2), 10E-11);
    assertEquals("two sample homoscedastic p value", 0.4833963785,
            TestUtils.homoscedasticTTest(sampleStats1, sampleStats2), 1E-10);
    assertTrue("two sample homoscedastic t-test reject",
            TestUtils.homoscedasticTTest(sample1, sample2, 0.49));
    assertTrue("two sample homoscedastic t-test accept",
            !TestUtils.homoscedasticTTest(sample1, sample2, 0.48));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:23,代码来源:TestUtilsTest.java

示例9: 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);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:RandomDataTest.java

示例10: calculate

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
@Override
public boolean calculate() {
    if (System.currentTimeMillis() > nextRecord) {
        ValueStat v = new ValueStat();
        v.setKey(key);
        if (workingValues.isEmpty()) {
            v.setValue(0.0);
        } else {
            SummaryStatistics summary = new SummaryStatistics();
            synchronized (workingValues) {
                for (ValueStat vs : workingValues) {
                    summary.addValue(vs.getValue());
                }
            }
            switch (operation) {
            case AVERAGE:
                v.setValue(summary.getMean());
                break;
            case SUM:
                v.setValue(summary.getSum());
                break;
            }
        }
        history.add(v);
        nextRecord = nextExtractionTime();
        return true;
    }
    return false;
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:30,代码来源:ValueMemoryType.java

示例11: getTCO

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
private SummaryStatistics getTCO() {
	SummaryStatistics summary = new SummaryStatistics();
	for (GraphMetricItem gmi : listOfObjects.values()) {
		summary.addValue(gmi.noTrLinks);
	}
	return summary;
}
 
开发者ID:aroog,项目名称:code,代码行数:8,代码来源:OOGMetricsReport.java

示例12: getScattering

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
private SummaryStatistics getScattering() {
	SummaryStatistics summary = new SummaryStatistics();
	for (GraphMetricItem gmi : listOfObjects.values()) {
		summary.addValue(gmi.objectScattering);
	}
	return summary;
}
 
开发者ID:aroog,项目名称:code,代码行数:8,代码来源:OOGMetricsReport.java

示例13: getNoObjectsInDomains

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
private SummaryStatistics getNoObjectsInDomains() {
	SummaryStatistics summary = new SummaryStatistics();
	for (GraphMetricItem gmi : listOfDomains.values()) {
		summary.addValue(gmi.getOutOwnDegree());
	}
	return summary;
}
 
开发者ID:aroog,项目名称:code,代码行数:8,代码来源:OOGMetricsReport.java

示例14: getPublicDInObjects

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
private SummaryStatistics getPublicDInObjects() {
	SummaryStatistics summary = new SummaryStatistics();
	for (GraphMetricItem mi : listOfObjects.values()) {
		if (mi.getType() != NodeType.ORoot)
			summary.addValue(mi.noPublicDomains);
	}
	return summary;
}
 
开发者ID:aroog,项目名称:code,代码行数:9,代码来源:OOGMetricsReport.java

示例15: getPrivateDInObjects

import org.apache.commons.math.stat.descriptive.SummaryStatistics; //导入方法依赖的package包/类
private SummaryStatistics getPrivateDInObjects() {
	SummaryStatistics summary = new SummaryStatistics();
	for (GraphMetricItem mi : listOfObjects.values()) {
		if (mi.getType() != NodeType.ORoot)
			summary.addValue(mi.noPrivateDomains);
	}
	return summary;
}
 
开发者ID:aroog,项目名称:code,代码行数:9,代码来源:OOGMetricsReport.java


注:本文中的org.apache.commons.math.stat.descriptive.SummaryStatistics.addValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。