Example usage for org.apache.commons.math.stat.descriptive SummaryStatistics clear

List of usage examples for org.apache.commons.math.stat.descriptive SummaryStatistics clear

Introduction

In this page you can find the example usage for org.apache.commons.math.stat.descriptive SummaryStatistics clear.

Prototype

public void clear() 

Source Link

Document

Resets all statistics and storage

Usage

From source file:org.dishevelled.analysis.examples.GraphSummary.java

@Override
public void run() {
    try {//from  ww w. j  a v a2  s.c  om
        GraphMLReader<Long, Double> reader = new GraphMLReader<Long, Double>(xmlReader);
        reader.setNodeValueHandler(new LongElementHandler());
        reader.setEdgeValueHandler(new DoubleElementHandler());
        Graph<Long, Double> graph = graphFile == null ? reader.read(System.in) : reader.read(graphFile);

        System.out.println("nodes=" + graph.nodeCount());
        System.out.println("edges=" + graph.edgeCount());

        SummaryStatistics summary = new SummaryStatistics();
        for (Node<Long, Double> node : graph.nodes()) {
            summary.addValue(node.degree());
        }
        System.out.println("min degree=" + summary.getMin());
        System.out.println("mean degree=" + summary.getMean() + " +/- " + summary.getStandardDeviation());
        System.out.println("max degree=" + summary.getMax());
        summary.clear();

        Set<Set<Node<Long, Double>>> connectedComponents = GraphUtils.connectedComponents(graph);
        System.out.println("connected components=" + connectedComponents.size());
        for (Set<Node<Long, Double>> connectedComponent : connectedComponents) {
            summary.addValue(connectedComponent.size());
        }
        System.out.println("min connected component size=" + summary.getMin());
        System.out.println("mean connected component size=" + summary.getMean() + " +/- "
                + summary.getStandardDeviation());
        System.out.println("max connected component size=" + summary.getMax());
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:org.openehealth.ipf.commons.test.performance.processingtime.ProcessingTimeStatistics.java

@Override
public void reset() {
    for (SummaryStatistics s : statisticsByMeasurementName.values()) {
        s.clear();
    }/*  w w w.  ja v  a  2 s .com*/
    statisticsByMeasurementName.clear();
}