Example usage for weka.experiment Stats add

List of usage examples for weka.experiment Stats add

Introduction

In this page you can find the example usage for weka.experiment Stats add.

Prototype

public void add(double value) 

Source Link

Document

Adds a value to the observed values

It's equivalent to add(value, 1)

Usage

From source file:machinelearningcw.EnhancedLinearPerceptron.java

public void calculateMeansAndSTDev(Instances instances) {
    means = new double[instances.numAttributes() - 1];//intialize means
    std = new double[instances.numAttributes() - 1];//intialize stdevs
    for (int j = 0; j < instances.numAttributes() - 1; j++) {
        Stats s = new Stats();

        for (int i = 0; i < instances.numInstances(); i++) {
            s.add(instances.get(i).value(j));//adds values to calc std
        }/*  ww w .ja v  a  2s  .c  o m*/
        s.calculateDerived(); //calculates mean and stdDev
        means[j] = s.mean;
        std[j] = s.stdDev;
    }

}