Example usage for org.apache.commons.math3.stat.descriptive DescriptiveStatistics clear

List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics clear

Introduction

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

Prototype

public void clear() 

Source Link

Document

Resets all statistics and storage

Usage

From source file:org.wso2.carbon.ml.core.spark.models.ext.AnomalyDetectionModel.java

/**
 * This method is to get the percentile distance to a given cluster
 *///from w  w w  .  j  a  v a 2 s  .co m
private double getPercentileDistance(double percentileValue, int clusterIndex) {

    // Get a DescriptiveStatistics instance
    DescriptiveStatistics stats = new DescriptiveStatistics();

    // calculating percentile distance
    for (double distance : clusterIndexToDistancesListMap.get(clusterIndex)) {
        stats.addValue(distance);
    }
    double percentileDistance = stats.getPercentile(percentileValue);
    stats.clear();

    return percentileDistance;
}