Normalization implements Function<double[], double[]> { public Normalization(Builder builder) { this.max = builder.max; this.min = builder.min; } Normalization(Builder builder); @Override double[] call(double[] values);  }
@Test public void testNormalization() throws MLModelBuilderException { Normalization normalization = new Normalization.Builder().minMax(max, min).build(); double[] normalizedRow = normalization.call(new double[] { 1.0, 7.0, 30.0, 1.0 }); Assert.assertEquals(normalizedRow, new double[] { 0.0, 1.0, 0.5, 0.5 }); normalizedRow = normalization.call(new double[] { 5.0, 3.0, 20.0, 2.0 }); Assert.assertEquals(normalizedRow, new double[] { 0.375, 0.6, 0.25, 1.0 }); normalizedRow = normalization.call(new double[] { 9.0, -5.0, 8.0, 0.0 }); Assert.assertEquals(normalizedRow, new double[] { 0.875, 0.0, 0.0, 0.0 }); normalizedRow = normalization.call(new double[] { 10.0, 6.0, 45.0, 3.0 }); Assert.assertEquals(normalizedRow, new double[] { 1.0, 1.0, 0.875, 1.0 }); }