Example usage for org.apache.mahout.classifier.df.data Data isEmpty

List of usage examples for org.apache.mahout.classifier.df.data Data isEmpty

Introduction

In this page you can find the example usage for org.apache.mahout.classifier.df.data Data isEmpty.

Prototype

public boolean isEmpty() 

Source Link

Usage

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

License:Apache License

/**
 * Classifies the data and calls callback for each classification
 *///from w w w . j  a v a 2 s  .c om
public void classify(Data data, double[] predictions) {
    Preconditions.checkArgument(data.size() == predictions.length,
            "predictions.length must be equal to data.size()");

    if (data.isEmpty()) {
        return; // nothing to classify
    }

    for (Node tree : trees) {
        for (int index = 0; index < data.size(); index++) {
            predictions[index] = tree.classify(data.get(index));
        }
    }
}