String line = scanner.nextLine();
if (line.isEmpty()) {
continue; // skip empty lines
}
Instance instance = converter.convert(0, line);
int prediction = forest.classify(rng, instance);
if (outputPath != null) {
ofile.writeChars(Integer.toString(prediction)); // write the prediction
ofile.writeChar('\n');
}
if (analyzer != null) {
analyzer.addInstance(dataset.getLabel(instance.getLabel()),
new ClassifierResult(dataset.getLabel(prediction), 1.0));
}
}
scanner.close();