NormalizationTrainer implements PreprocessingTrainer<K, V> { @Override public NormalizationPreprocessor<K, V> fit( LearningEnvironmentBuilder envBuilder, DatasetBuilder<K, V> datasetBuilder, Preprocessor<K, V> basePreprocessor) { return new NormalizationPreprocessor<>(p, basePreprocessor); }  @Override NormalizationPreprocessor<K, V> fit(
        LearningEnvironmentBuilder envBuilder,
        DatasetBuilder<K, V> datasetBuilder,
        Preprocessor<K, V> basePreprocessor); double p(); NormalizationTrainer<K, V> withP(double p);  }
@Test public void testFit() { Map<Integer, Vector> data = new HashMap<>(); data.put(1, VectorUtils.of(2, 4, 1)); data.put(2, VectorUtils.of(1, 8, 22)); data.put(3, VectorUtils.of(4, 10, 100)); data.put(4, VectorUtils.of(0, 22, 300)); DatasetBuilder<Integer, Vector> datasetBuilder = new LocalDatasetBuilder<>(data, parts); final Vectorizer<Integer, Vector, Integer, Double> vectorizer = new DummyVectorizer<>(0, 1, 2); NormalizationTrainer<Integer, Vector> normalizationTrainer = new NormalizationTrainer<Integer, Vector>() .withP(3); assertEquals(3., normalizationTrainer.p(), 0); NormalizationPreprocessor<Integer, Vector> preprocessor = normalizationTrainer.fit( TestUtils.testEnvBuilder(), datasetBuilder, vectorizer ); assertEquals(normalizationTrainer.p(), preprocessor.p(), 0); assertArrayEquals(new double[] {0.125, 0.99, 0.125}, preprocessor.apply(5, VectorUtils.of(1., 8., 1.)).features().asArray(), 1e-2); }