* @param path data path
* @return
*/
public static int[] extractLabels(Dataset dataset, FileSystem fs, Path path) throws IOException {
FSDataInputStream input = fs.open(path);
FileLineIterator iterator = new FileLineIterator(input);
int[] labels = new int[dataset.nbInstances()];
DataConverter converter = new DataConverter(dataset);
int index = 0;
while (iterator.hasNext()) {
labels[index++] = converter.convert(0, iterator.next()).label;
}
iterator.close();
return labels;
}