@Test public void testNormalize() throws Exception { DiscreteNormalizer dn = new DiscreteNormalizer(0, 10, 1d); Assert.assertTrue(Maths.equals(0, dn.normalize(0.5), 2)); Assert.assertTrue(Maths.equals(0, dn.normalize(0.99), 2)); Assert.assertTrue(Maths.equals(0.1, dn.normalize(1), 2)); Assert.assertTrue(Maths.equals(0.1, dn.normalize(1.01), 2)); Assert.assertTrue(Maths.equals(1, dn.normalize(10), 2)); Assert.assertTrue(Maths.equals(0.9, dn.normalize(9.99), 2)); }
@Override public double normalize(double value) { double normalizedValue = normalizer.normalize(value); double result = min; while (true) { if (result + step > normalizedValue) { break; } else { result += step; } } return result; }
DiscreteNormalizer implements Normalizer { @Override public double normalize(double value) { double normalizedValue = normalizer.normalize(value); double result = min; while (true) { if (result + step > normalizedValue) { break; } else { result += step; } } return result; } }
DiscreteNormalizer implements Normalizer { @Override public double normalize(double value) { double normalizedValue = normalizer.normalize(value); double result = min; while (true) { if (result + step > normalizedValue) { break; } else { result += step; } } return result; } DiscreteNormalizer(double min, double max, int steps);  DiscreteNormalizer(double min, double max, int steps, @Nullable Normalizer normalizer);  DiscreteNormalizer(double min, double max, double step); }
DiscreteNormalizer implements Normalizer { @Override public double normalize(double value) { double normalizedValue = normalizer.normalize(value); double result = min; while (true) { if (result + step > normalizedValue) { break; } else { result += step; } } return result; } DiscreteNormalizer(double min, double max, int steps);  DiscreteNormalizer(double min, double max, int steps, @Nullable Normalizer normalizer);  DiscreteNormalizer(double min, double max, double step); @Override double normalize(double value); @Override double denormalize(double value); }
DiscreteNormalizer implements Normalizer { @Override public double normalize(double value) { double normalizedValue = normalizer.normalize(value); double result = min; while (true) { if (result + step > normalizedValue) { break; } else { result += step; } } return result; } DiscreteNormalizer(double min, double max, int steps);  DiscreteNormalizer(double min, double max, int steps, @Nullable Normalizer normalizer);  DiscreteNormalizer(double min, double max, double step); @Override double normalize(double value); @Override double denormalize(double value);  }