@Test public void testIsMissingClass() { final double[] fieldValues = fieldValues(index -> index); final MockInstance instanceNotMissing = new MockInstance(fieldValues); assertThat(InstanceUtils.isMissingClass(instanceNotMissing, this.schema)) .as("Check when the class is present") .isFalse(); fieldValues[this.schema.getTargetIndex().get()] = Double.NaN; final MockInstance instanceMissing = new MockInstance(fieldValues); assertThat(InstanceUtils.isMissingClass(instanceMissing, this.schema)) .as("Check when the class is missing") .isTrue(); }
public static boolean isMissingClass(final Instance instance, final DatasetSchema schema) { return getClassValue(instance, schema) .map(value -> Double.isNaN(value)) .orElse(true); }
InstanceUtils { public static boolean isMissingClass(final Instance instance, final DatasetSchema schema) { return getClassValue(instance, schema) .map(value -> Double.isNaN(value)) .orElse(true); } }
InstanceUtils { public static boolean isMissingClass(final Instance instance, final DatasetSchema schema) { return getClassValue(instance, schema) .map(value -> Double.isNaN(value)) .orElse(true); } private  InstanceUtils(); }
InstanceUtils { public static boolean isMissingClass(final Instance instance, final DatasetSchema schema) { return getClassValue(instance, schema) .map(value -> Double.isNaN(value)) .orElse(true); } private  InstanceUtils(); static Optional<Double> getClassValue(final Instance instance, final DatasetSchema schema); static boolean isMissingClass(final Instance instance, final DatasetSchema schema); static boolean isMissing(final Instance instance, final int index); }
InstanceUtils { public static boolean isMissingClass(final Instance instance, final DatasetSchema schema) { return getClassValue(instance, schema) .map(value -> Double.isNaN(value)) .orElse(true); } private  InstanceUtils(); static Optional<Double> getClassValue(final Instance instance, final DatasetSchema schema); static boolean isMissingClass(final Instance instance, final DatasetSchema schema); static boolean isMissing(final Instance instance, final int index);  }