LabeledVectorSet extends Dataset<Row> implements AutoCloseable { public double[] labels() { assert data != null; assert data.length > 0; double[] labels = new double[data.length]; for (int i = 0; i < data.length; i++) labels[i] = (double)data[i].label(); return labels; } LabeledVectorSet();  LabeledVectorSet(int rowSize, int colSize, boolean isDistributed);  LabeledVectorSet(int rowSize, int colSize);  LabeledVectorSet(int rowSize, int colSize, String[] featureNames, boolean isDistributed);  LabeledVectorSet(Row[] data);  LabeledVectorSet(Row[] data, int colSize);  LabeledVectorSet(double[][] mtx, double[] lbs);  LabeledVectorSet(double[][] mtx, double[] lbs, String[] featureNames, boolean isDistributed); double label(int idx); double[] labels(); void setLabel(int idx, double lb); static Vector emptyVector(int size, boolean isDistributed); LabeledVectorSet copy(); @Override void close();  }
@Test public void testLabels() { double[][] mtx = new double[][] { {1.0, 1.0}, {1.0, 2.0}, {2.0, 1.0}, {-1.0, -1.0}, {-1.0, -2.0}, {-2.0, -1.0}}; double[] lbs = new double[] {1.0, 1.0, 1.0, 2.0, 2.0, 2.0}; LabeledVectorSet dataset = new LabeledVectorSet(mtx, lbs); final double[] labels = dataset.labels(); for (int i = 0; i < lbs.length; i++) assertEquals(lbs[i], labels[i], 0); }