Example usage for org.apache.mahout.classifier.df DFUtils readIntArray

List of usage examples for org.apache.mahout.classifier.df DFUtils readIntArray

Introduction

In this page you can find the example usage for org.apache.mahout.classifier.df DFUtils readIntArray.

Prototype

public static int[] readIntArray(DataInput in) throws IOException 

Source Link

Document

Reads an int[] from a DataInput

Usage

From source file:com.wsc.myexample.decisionForest.MyDataset.java

License:Apache License

public void readFields(DataInput in) throws IOException {
    int nbAttributes = in.readInt();
    attributes = new Dataset.Attribute[nbAttributes];
    for (int attr = 0; attr < nbAttributes; attr++) {
        String name = readString(in);
        attributes[attr] = Dataset.Attribute.valueOf(name);
    }// www . jav  a 2s.com

    ignored = DFUtils.readIntArray(in);

    // only CATEGORICAL attributes have values
    values = new String[nbAttributes][];
    for (int attr = 0; attr < nbAttributes; attr++) {
        if (attributes[attr].isCategorical()) {
            values[attr] = readStringArray(in);
        }
    }

    labelId = in.readInt();
    nbInstances = in.readInt();
}