MultiLabelClassificationPredictionBatch implements IMultiLabelClassificationPredictionBatch { @Override public int[][] getThresholdedPredictionMatrix(final double threshold) { int[][] predictionMatrix = new int[this.batch.size()][]; IntStream.range(0, this.batch.size()).forEach(x -> predictionMatrix[x] = this.batch.get(x).getPrediction(threshold)); return predictionMatrix; } MultiLabelClassificationPredictionBatch(final List<? extends IMultiLabelClassification> batch);  MultiLabelClassificationPredictionBatch(final IMultiLabelClassification[] batch); @Override IMultiLabelClassification get(final int index); @Override int getNumPredictions(); @Override List<? extends IMultiLabelClassification> getPredictions(); @Override double[][] getPredictionMatrix(); @Override int[][] getThresholdedPredictionMatrix(final double threshold); @Override int[][] getThresholdedPredictionMatrix(final double[] threshold);  }
@Test public void testGetThresholdedLabelRelevanceVector() { int[][] pred = classification.getThresholdedPredictionMatrix(THRESHOLD_SINGLE); assertEquals("Prediction vector and ground truth value vector are not of the same length", EXPECTED_THRESHOLDED_SINGLE.length, pred.length); for (int i = 0; i < EXPECTED_THRESHOLDED_SINGLE.length; i++) { for (int j = 0; j < EXPECTED_THRESHOLDED_SINGLE[i].length; j++) { assertEquals("Prediction vector is not as expected for index " + i + ":" + j + ".", EXPECTED_THRESHOLDED_SINGLE[i][j], pred[i][j], DOUBLE_DELTA); } } }
@Test public void testGetLabelWiseThresholdedLabelRelevanceVector() { int[][] pred = classification.getThresholdedPredictionMatrix(THRESHOLD_VECTOR); assertEquals("Prediction vector and ground truth value vector are not of the same length", EXPECTED_THRESHOLDED_VECTOR.length, pred.length); for (int i = 0; i < EXPECTED_THRESHOLDED_VECTOR.length; i++) { for (int j = 0; j < EXPECTED_THRESHOLDED_SINGLE[i].length; j++) { assertEquals("Prediction vector is not as expected for index " + i + ":" + j + ".", EXPECTED_THRESHOLDED_VECTOR[i][j], pred[i][j], DOUBLE_DELTA); } } }