MultiLabelClassification extends Prediction implements IMultiLabelClassification { @Override public int[] getRelevantLabels(final double threshold) { return IntStream.range(0, this.getPrediction().length).filter(x -> this.getPrediction()[x] >= threshold).toArray(); } MultiLabelClassification(final double[] predicted);  MultiLabelClassification(final double[] predicted, final double threshold);  MultiLabelClassification(final double[] predicted, final double[] threshold); @Override double[] getPrediction(); int[] getThresholdedPrediction(); @Override int[] getPrediction(final double threshold); @Override int[] getPrediction(final double[] threshold); @Override int[] getRelevantLabels(final double threshold); @Override int[] getIrrelevantLabels(final double threshold);  }
@Test public void getRelevantLabels() { int[] relevantLabels = classification.getRelevantLabels(0.5); assertEquals("Prediction vector and ground truth value vector are not of the same length", RELEVANT_LABELS.length, relevantLabels.length); for (int i = 0; i < RELEVANT_LABELS.length; i++) { assertEquals("Relevant labels do not match. Expected: " + Arrays.toString(RELEVANT_LABELS) + " actual: " + Arrays.toString(relevantLabels), RELEVANT_LABELS[i], relevantLabels[i]); } }