MeanImputation implements Function<String[], String[]> { public MeanImputation(Builder builder) { this.meanImputation = builder.meanImputation; } MeanImputation(Builder builder); @Override String[] call(String[] tokens);  }
@Test public void testMeanImputation() throws MLModelBuilderException { MeanImputation meanImputation = new MeanImputation.Builder().imputations(meanImputationValues).build(); String[] meanImputedRow = meanImputation.call(new String[] { "1.2", "2.5", "3.5", "4.3" }); Assert.assertEquals(meanImputedRow, new String[] { "1.2", "2.5", "3.5", "4.3" }); meanImputedRow = meanImputation.call(new String[] { "1.2", "?", "3.5", "4.3" }); Assert.assertEquals(meanImputedRow, new String[] { "1.2", "2.2", "3.5", "4.3" }); meanImputedRow = meanImputation.call(new String[] { "1.2", "2.5", "NA", "4.3" }); Assert.assertEquals(meanImputedRow, new String[] { "1.2", "2.5", "3.2", "4.3" }); meanImputedRow = meanImputation.call(new String[] { "1.2", "2.5", "3.5", "" }); Assert.assertEquals(meanImputedRow, new String[] { "1.2", "2.5", "3.5", "4.2" }); }