home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (CombinedPreProcessor.java)

This example Java source code file (CombinedPreProcessor.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

arraylist, builder, combinedpreprocessor, datasetpreprocessor, list, nonnull, override, util

The CombinedPreProcessor.java Java example source code

package org.deeplearning4j.datasets.iterator;

import lombok.NonNull;
import org.nd4j.linalg.dataset.api.DataSet;
import org.nd4j.linalg.dataset.api.DataSetPreProcessor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

 * This is special preProcessor, that allows to combine multiple prerpocessors, and apply them to data sequentially.
 * @author raver119@gmail.com
public class CombinedPreProcessor implements DataSetPreProcessor {
    private List<DataSetPreProcessor> preProcessors;

    private CombinedPreProcessor() {

     * Pre process a dataset sequentially
     * @param toPreProcess the data set to pre process
    public void preProcess(DataSet toPreProcess) {
        for(DataSetPreProcessor preProcessor: preProcessors) {

    public static class Builder {
        private List<DataSetPreProcessor> preProcessors = new ArrayList<>();

        public Builder() {


        public Builder addPreProcessor(@NonNull DataSetPreProcessor preProcessor) {
            return this;

        public Builder addPreProcessor(int idx, @NonNull DataSetPreProcessor preProcessor) {
            preProcessors.add(idx, preProcessor);
            return this;

        public CombinedPreProcessor build() {
            CombinedPreProcessor preProcessor = new CombinedPreProcessor();
            preProcessor.preProcessors = this.preProcessors;
            return preProcessor;

Other Java examples (source code examples)

Here is a short list of links related to this Java CombinedPreProcessor.java source code file:

my book on functional programming


new blog posts


Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.