@Test public void testGetClassValue() { final double[] fieldValues = fieldValues(index -> index * 10.0); final MockInstance instance = new MockInstance(fieldValues); final Optional<Integer> targetIndex = this.schema.getTargetIndex(); assertThat(targetIndex) .as("The dataset target variable index") .isPresent(); assertThat(InstanceUtils.getClassValue(instance, this.schema)) .as("The class value for the instance") .hasValue(targetIndex.get() * 10.0); }
public static Optional<Double> getClassValue(final Instance instance, final DatasetSchema schema) { return schema.getTargetIndex() .map(instance::getValue); }
InstanceUtils { public static Optional<Double> getClassValue(final Instance instance, final DatasetSchema schema) { return schema.getTargetIndex() .map(instance::getValue); } }
InstanceUtils { public static Optional<Double> getClassValue(final Instance instance, final DatasetSchema schema) { return schema.getTargetIndex() .map(instance::getValue); } private  InstanceUtils(); }
InstanceUtils { public static Optional<Double> getClassValue(final Instance instance, final DatasetSchema schema) { return schema.getTargetIndex() .map(instance::getValue); } 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 Optional<Double> getClassValue(final Instance instance, final DatasetSchema schema) { return schema.getTargetIndex() .map(instance::getValue); } 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);  }