Example usage for weka.experiment Stats Stats

List of usage examples for weka.experiment Stats Stats

Introduction

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

Prototype

Stats

Source Link

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
        }//from   w  w w.ja  va2 s.  co  m
        s.calculateDerived(); //calculates mean and stdDev
        means[j] = s.mean;
        std[j] = s.stdDev;
    }

}