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


Java SummaryStatistics类代码示例

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


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

示例1: getStats

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
private static Stats getStats(FloatColumn values, SummaryStatistics summaryStatistics) {
    Stats stats = new Stats("Column: " + values.name());
    stats.min = (float) summaryStatistics.getMin();
    stats.max = (float) summaryStatistics.getMax();
    stats.n = summaryStatistics.getN();
    stats.sum = summaryStatistics.getSum();
    stats.variance = summaryStatistics.getVariance();
    stats.populationVariance = summaryStatistics.getPopulationVariance();
    stats.quadraticMean = summaryStatistics.getQuadraticMean();
    stats.geometricMean = summaryStatistics.getGeometricMean();
    stats.mean = summaryStatistics.getMean();
    stats.standardDeviation = summaryStatistics.getStandardDeviation();
    stats.sumOfLogs = summaryStatistics.getSumOfLogs();
    stats.sumOfSquares = summaryStatistics.getSumsq();
    stats.secondMoment = summaryStatistics.getSecondMoment();
    return stats;
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:18,代码来源:Stats.java

示例2: ChronoFrequency

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
public ChronoFrequency(@NotNull ChronoUnit chronoUnit, int chronoSeriesPosition,
                       long minimumFrequency, long maximumFrequency, @NotNull Instant lastOccurrenceTimestamp) {
    super(chronoSeriesPosition);
    this.chronoUnit = requireNonNull(chronoUnit);
    this.frequencyStatistics = new SummaryStatistics();
    this.frequencyStatistics.addValue(minimumFrequency);
    if (minimumFrequency != maximumFrequency) {
        this.frequencyStatistics.addValue(maximumFrequency);
    }
    this.lastOccurrenceTimestamp = requireNonNull(lastOccurrenceTimestamp);

    if (minimumFrequency < 0 || maximumFrequency < 0) {
        throw new IllegalArgumentException("Minimum and maximum frequency must be greater than zero");
    } else if (minimumFrequency > maximumFrequency || maximumFrequency < minimumFrequency) {
        throw new IllegalArgumentException("Invalid minimum and maximum frequency combination");
    }
}
 
开发者ID:BFergerson,项目名称:Chronetic,代码行数:18,代码来源:ChronoFrequency.java

示例3: getAggregateStats

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
public void getAggregateStats(double[] values1, double[] values2){
	AggregateSummaryStatistics aggregate = new AggregateSummaryStatistics();
	SummaryStatistics firstSet = aggregate.createContributingStatistics();
	SummaryStatistics secondSet = aggregate.createContributingStatistics();
	
	for(int i = 0; i < values1.length; i++) {
		firstSet.addValue(values1[i]);
	}
	for(int i = 0; i < values2.length; i++) {
		secondSet.addValue(values2[i]);
	}
	
	double sampleSum = aggregate.getSum();
	double sampleMean = aggregate.getMean();
	double sampleStd= aggregate.getStandardDeviation();
	System.out.println(sampleSum + "\t" + sampleMean + "\t" + sampleStd);
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:18,代码来源:AggregateStats.java

示例4: computeStats

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
private void computeStats() {
  SummaryStatistics centroidStats = new SummaryStatistics();
  SummaryStatistics edgeStats = new SummaryStatistics();
  for (IFeature poi : pois) {
    centroidStats.addValue(getDistToCentroid().get(poi));
    edgeStats.addValue(getDistToEdge().get(poi));
  }
  meanDistanceCentroid = centroidStats.getMean();
  stdDistanceCentroid = centroidStats.getStandardDeviation();
  minDistanceCentroid = centroidStats.getMin();
  maxDistanceCentroid = centroidStats.getMax();
  meanDistanceEdge = edgeStats.getMean();
  stdDistanceEdge = edgeStats.getStandardDeviation();
  minDistanceEdge = edgeStats.getMin();
  maxDistanceEdge = edgeStats.getMax();
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:17,代码来源:BuildingConsistencyQualityAssessment.java

示例5: getEdges

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
private static FloatVector getEdges(MultiImage img) {
  SummaryStatistics[] stats = new SummaryStatistics[256];
  for (int i = 0; i < 256; ++i) {
    stats[i] = new SummaryStatistics();
  }
  List<Boolean> edgePixels = EdgeImg.getEdgePixels(img,
      new ArrayList<Boolean>(img.getWidth() * img.getHeight()));
  ArrayList<LinkedList<Boolean>> partition = GridPartitioner.partition(edgePixels, img.getWidth(),
      img.getHeight(), 16, 16);
  for (int i = 0; i < partition.size(); ++i) {
    LinkedList<Boolean> edge = partition.get(i);
    SummaryStatistics stat = stats[i];
    for (boolean b : edge) {
      stat.addValue(b ? 1 : 0);
    }
  }
  float[] f = new float[256];
  for (int i = 0; i < 256; ++i) {
    f[i] = (float) stats[i].getMean();
  }

  return new FloatVectorImpl(f);
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:24,代码来源:EdgeGrid16Full.java

示例6: getEdges

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
private static FloatVector getEdges(MultiImage img) {
  SummaryStatistics[] stats = new SummaryStatistics[64];
  for (int i = 0; i < 64; ++i) {
    stats[i] = new SummaryStatistics();
  }
  List<Boolean> edgePixels = EdgeImg.getEdgePixels(img,
      new ArrayList<Boolean>(img.getWidth() * img.getHeight()));
  ArrayList<LinkedList<Boolean>> partition = ARPartioner.partition(edgePixels, img.getWidth(),
      img.getHeight(), 8, 8);
  for (int i = 0; i < partition.size(); ++i) {
    LinkedList<Boolean> edge = partition.get(i);
    SummaryStatistics stat = stats[i];
    for (boolean b : edge) {
      stat.addValue(b ? 1 : 0);
    }
  }
  float[] f = new float[64];
  for (int i = 0; i < 64; ++i) {
    f[i] = (float) stats[i].getMean();
  }

  return new FloatVectorImpl(f);
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:24,代码来源:EdgeARP88.java

示例7: getFeatures

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
/**
 * Returns a list of feature vectors given a SegmentContainer.
 *
 * @param segment SegmentContainer for which to calculate the feature vectors.
 * @return List of HPCP Shingle feature vectors.
 */
private List<float[]> getFeatures(SegmentContainer segment) {
    /* Create STFT; If this fails, return empty list. */
    Pair<Integer,Integer> parameters = FFTUtil.parametersForDuration(segment.getSamplingrate(), WINDOW_SIZE);
    STFT stft = segment.getSTFT(parameters.first,(parameters.first - 2*parameters.second)/2, parameters.second, new HanningWindow());
    if (stft == null) {
      return new ArrayList<>();
    }

    HPCP hpcps = new HPCP(this.resolution, this.min_frequency, this.max_frequency);
    hpcps.addContribution(stft);

    int vectors = Math.max(hpcps.size() - SHINGLE_SIZE, 1);
    final SummaryStatistics statistics = new SummaryStatistics();

    List<Pair<Double, float[]>> features = new ArrayList<>(vectors);
    for (int n = 0; n < vectors; n++) {
        Pair<Double, float[]> feature = this.getHPCPShingle(hpcps, n);
        features.add(feature);
        statistics.addValue(feature.first);
    }

    final double threshold = 0.25*statistics.getGeometricMean();
    return features.stream().filter(f -> (f.first > threshold)).map(f -> f.second).collect(Collectors.toList());
}
 
开发者ID:vitrivr,项目名称:cineast,代码行数:31,代码来源:HPCPShingle.java

示例8: calcClusterMeanInfo

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
private double calcClusterMeanInfo(Set<Integer> members) throws AdeInternalException {
    if (members.size() == 1){
        return 0;
    }
    final SummaryStatistics sumS = new SummaryStatistics();
    for (int i : members){
        for (int j : members) {
            if (i <= j){
                continue;
            }
            double v;
            v = m_informationMat.get(i, j);
            if (!Double.isNaN(v)){
                sumS.addValue(v);
            }
        }
    }
    final double res = sumS.getMean();
    if (Double.isNaN(res)){
        return 0;
    }
    return res;

}
 
开发者ID:openmainframeproject,项目名称:ade,代码行数:25,代码来源:AbstractClusteringScorer.java

示例9: init

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
@Override
    public void init(ProcessContext ctx) throws Exception {
        super.init(ctx);
        histPanel = new BarPlotPanel(drawErrors, title);
        frame = new JFrame();
        frame.getContentPane().setLayout(new BorderLayout());
        frame.getContentPane().add(histPanel, BorderLayout.CENTER);
        frame.setSize(width, height);
        frame.setVisible(true);
        for (String key : keys) {
            summaryStatisticsHashMap.put(key, new SummaryStatistics());
        }
//		frame.setTitle(title);
        if (keys == null) {
            log.error("The keys paramter was null. Did you set it in the .xml file?");
        }
    }
 
开发者ID:fact-project,项目名称:fact-tools,代码行数:18,代码来源:BarPlotter.java

示例10: processMatchingData

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
@Override
public Data processMatchingData(Data data) {
    DefaultStatisticalCategoryDataset dataset = new DefaultStatisticalCategoryDataset();

    for (String key : keys) {

        if (data.containsKey(key)) {
            String val = data.get(key).toString();
            double d = Double.parseDouble(val);
            SummaryStatistics ss = summaryStatisticsHashMap.get(key);
            ss.addValue(d);
            dataset.add(ss.getMean(), ss.getStandardDeviation(), " ", key);
        } else {
            log.warn("The key " + key + " does not exist in the Event");
        }
    }
    histPanel.setDataset(dataset);
    histPanel.getPreferredSize();
    return data;
}
 
开发者ID:fact-project,项目名称:fact-tools,代码行数:21,代码来源:BarPlotter.java

示例11: anovaStats

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
/**
 * This method calls the method that actually does the calculations (except
 * P-value).
 *
 * @param categoryData
 *            <code>Collection</code> of <code>double[]</code> arrays each
 *            containing data for one category
 * @return computed AnovaStats
 * @throws NullArgumentException
 *             if <code>categoryData</code> is <code>null</code>
 * @throws DimensionMismatchException
 *             if the length of the <code>categoryData</code> array is less
 *             than 2 or a contained <code>double[]</code> array does not
 *             contain at least two values
 */
private AnovaStats anovaStats(final Collection<double[]> categoryData)
    throws NullArgumentException, DimensionMismatchException {

    MathUtils.checkNotNull(categoryData);

    final Collection<SummaryStatistics> categoryDataSummaryStatistics =
            new ArrayList<SummaryStatistics>(categoryData.size());

    // convert arrays to SummaryStatistics
    for (final double[] data : categoryData) {
        final SummaryStatistics dataSummaryStatistics = new SummaryStatistics();
        categoryDataSummaryStatistics.add(dataSummaryStatistics);
        for (final double val : data) {
            dataSummaryStatistics.addValue(val);
        }
    }

    return anovaStats(categoryDataSummaryStatistics, false);

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:36,代码来源:OneWayAnova.java

示例12: delegateGetBucketForString

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
public static RunStats delegateGetBucketForString(int buckets) throws FileNotFoundException, Exception
{
    Long startTime = System.currentTimeMillis();
    PrimaryIndexBucketGeneratorImpl ibg = new PrimaryIndexBucketGeneratorImpl(FieldDataType.TEXT, buckets);
    PrimaryIndexBucketLocatorImpl locator = new PrimaryIndexBucketLocatorImpl(ibg.generateBuckets(), null, null, null, null, null, null, null, null);
    logger.debug("test to getBucket for the bucket distribution");
    String file = "/MostCommon20kEnglishWords.txt";
    String englishFile = Utils.readFile(file);
    String[] englishLines = englishFile.split("\n");
    HashMap<Long, List<Object>> hm = new HashMap<>();
    SummaryStatistics stats = new SummaryStatistics();
    for (String line : englishLines)
    {
        line = line.trim();
        Long bucketId = locator.getBucket(line, FieldDataType.TEXT);
        calculate(hm, stats, bucketId, line);
    }
    Long runTime = System.currentTimeMillis() - startTime;
    RunStats runStats = new RunStats("BucketForStrings", FieldDataType.TEXT, runTime, stats, hm);
    logger.debug(runStats.toString());
    return runStats;
}
 
开发者ID:PearsonEducation,项目名称:Docussandra,代码行数:23,代码来源:BucketCSV.java

示例13: delegateGetBucketForBoolean

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
/**
 * checks the Bucket Distribution for the Boolean values
 *
 * @throws IndexParseFieldException
 */
public static RunStats delegateGetBucketForBoolean(int buckets) throws Exception
{
    Long startTime = System.currentTimeMillis();
    PrimaryIndexBucketGeneratorImpl ibg = new PrimaryIndexBucketGeneratorImpl(FieldDataType.BOOLEAN, buckets);
    PrimaryIndexBucketLocatorImpl locator = new PrimaryIndexBucketLocatorImpl(null, null, null, null, ibg.generateBuckets(), null, null, null, null);
    logger.debug("Test to getBucket for the bucket distribution on Boolean values");
    HashMap<Long, List<Object>> hm = new HashMap<>();
    SummaryStatistics stats = new SummaryStatistics();
    for (int i = 0; i < 20000; i++)
    {
        Boolean randomBoolean = RandomUtils.nextBoolean();
        Long bucketId = locator.getBucket(randomBoolean, FieldDataType.BOOLEAN);
        TestUtils.calculate(hm, stats, bucketId, randomBoolean);
    }
    Long runTime = System.currentTimeMillis() - startTime;
    RunStats runStats = new RunStats("BucketForBoolean", FieldDataType.BOOLEAN, runTime, stats, hm);
    logger.debug(runStats.toString());
    return runStats;
}
 
开发者ID:PearsonEducation,项目名称:Docussandra,代码行数:25,代码来源:BucketCSV.java

示例14: delegateGetBucketForUuids

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
/**
 * Test to check the Bucket Distribution for the UUID values
 *
 * @throws IndexParseFieldException
 */
public static RunStats delegateGetBucketForUuids(int buckets) throws Exception
{
    Long startTime = System.currentTimeMillis();
    PrimaryIndexBucketGeneratorImpl ibg = new PrimaryIndexBucketGeneratorImpl(FieldDataType.UUID, buckets);
    PrimaryIndexBucketLocatorImpl locator = new PrimaryIndexBucketLocatorImpl(null, null, null, null, null, ibg.generateBuckets(), null, null, null);
    logger.debug("test to getBucket for the bucket distribution on UUIDs");
    HashMap<Long, List<Object>> hm = new HashMap<>();
    SummaryStatistics stats = new SummaryStatistics();
    UUID[] uuid = new UUID[10000];
    for (int i = 0; i < 10000; i++)
    {
        uuid[i] = UUID.randomUUID();
    }
    for (int inputUuid = 0; inputUuid < 10000; inputUuid++)
    {
        Long bucketId = locator.getBucket(uuid[inputUuid], FieldDataType.UUID);
        calculate(hm, stats, bucketId, inputUuid);
    }
    Long runTime = System.currentTimeMillis() - startTime;
    RunStats runStats = new RunStats("BucketForUUIDs", FieldDataType.UUID, runTime, stats, hm);
    logger.debug(runStats.toString());
    return runStats;
}
 
开发者ID:PearsonEducation,项目名称:Docussandra,代码行数:29,代码来源:BucketCSV.java

示例15: delegateGetBucketForIntegers

import org.apache.commons.math3.stat.descriptive.SummaryStatistics; //导入依赖的package包/类
/**
 * Test to check the Bucket Distribution for the common Integer values
 *
 * @throws IndexParseFieldException
 */
public static RunStats delegateGetBucketForIntegers(int buckets) throws Exception
{
    Long startTime = System.currentTimeMillis();
    PrimaryIndexBucketGeneratorImpl ibg = new PrimaryIndexBucketGeneratorImpl(FieldDataType.INTEGER, buckets);
    PrimaryIndexBucketLocatorImpl locator = new PrimaryIndexBucketLocatorImpl(null, null, null, ibg.generateBuckets(), null, null, null, null, null);
    logger.debug("test to getBucket for the bucket distribution");
    HashMap<Long, List<Object>> hm = new HashMap<>();
    SummaryStatistics stats = new SummaryStatistics();
    for (int inputInt = -2000000; inputInt < 2000000; inputInt++)
    {
        Long bucketId = locator.getBucket(inputInt, FieldDataType.INTEGER);
        calculate(hm, stats, bucketId, inputInt);
    }
    Long runTime = System.currentTimeMillis() - startTime;
    RunStats runStats = new RunStats("BucketForIntegers", FieldDataType.INTEGER, runTime, stats, hm);
    logger.debug(runStats.toString());
    return runStats;
}
 
开发者ID:PearsonEducation,项目名称:Docussandra,代码行数:24,代码来源:BucketCSV.java


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