Example usage for weka.core Instances enumerateInstances

List of usage examples for weka.core Instances enumerateInstances

Introduction

In this page you can find the example usage for weka.core Instances enumerateInstances.

Prototype

publicEnumeration<Instance> enumerateInstances() 

Source Link

Document

Returns an enumeration of all instances in the dataset.

Usage

From source file:reactivetechnologies.sentigrade.dto.VectorRequestData.java

License:Apache License

public void setTextInstances(Instances texts, String domain) {
    int c = texts.classIndex();
    int t = c == 0 ? 1 : 0;
    for (Instance text : Collections.list(texts.enumerateInstances())) {
        getDataSet().add(new Tuple(text.stringValue(t), text.stringValue(c)));

    }//from  ww w.jav a 2s.  co m
    getClasses().addAll(classAttrNominals(texts));
    setDomain(domain);
}

From source file:tubes1.myClassifiers.myC45.java

private Instances[] splitData(Instances data, Attribute att) {

    Instances[] splitData = new Instances[att.numValues()];
    for (int j = 0; j < att.numValues(); j++) {
        splitData[j] = new Instances(data, data.numInstances());
    }//from   w ww. ja v a 2 s. co m
    Enumeration instEnum = data.enumerateInstances();
    while (instEnum.hasMoreElements()) {
        Instance inst = (Instance) instEnum.nextElement();
        splitData[(int) inst.value(att)].add(inst);
    }
    for (int i = 0; i < splitData.length; i++) {
        splitData[i].compactify();
    }
    return splitData;
}