Example usage for weka.experiment Stats calculateDerived

List of usage examples for weka.experiment Stats calculateDerived

Introduction

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

Prototype

public void calculateDerived() 

Source Link

Document

Tells the object to calculate any statistics that don't have their values automatically updated during add.

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
        }//  w  w  w .  j av  a 2s.  c o  m
        s.calculateDerived(); //calculates mean and stdDev
        means[j] = s.mean;
        std[j] = s.stdDev;
    }

}