Example usage for weka.core DenseInstance toString

List of usage examples for weka.core DenseInstance toString

Introduction

In this page you can find the example usage for weka.core DenseInstance toString.

Prototype

@Override
public String toString() 

Source Link

Document

Returns the description of one instance.

Usage

From source file:edu.teco.context.recognition.WekaManager.java

License:Apache License

private void fillData(double[] featureValues, String className, Instances data) {

    double[] vals = new double[data.numAttributes()];

    if (vals.length != (featureValues.length + 1)) {
        if (FrameworkContext.WARN)
            Log.w(TAG, "Number of feature values and weka instance values differs.");
    }/* ww w . j  a  va2  s .c o m*/

    for (int i = 0; i < featureValues.length; i++) {
        vals[i] = featureValues[i];
    }

    vals[vals.length - 1] = attClassVals.indexOf(className);

    DenseInstance instance = new DenseInstance(1.0, vals);

    if (isLogDirectlyToFile) {
        instance.setDataset(data);
        logArffData(instance.toString());
    } else {
        // add
        data.add(instance);
    }
}