deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java
/**
     * Fit the dataset rdd
     * @param rdd the rdd to fitDataSet
     * @return the multi layer network
     */
Fit the dataset rdd
@param rdd the rdd to fitDataSet
@return the multi layer network
Fit the dataset rdd @param rdd the rdd to fitDataSet @return the multi layer network
public MultiLayerNetwork fitDataSet(JavaRDD<DataSet> rdd) {
        int iterations = conf.getConf(0).getNumIterations();
        log.info("Running distributed training:  (averaging each iteration = " + averageEachIteration + "), (iterations =" +
                iterations + "), (num partions = " + rdd.partitions().size() + ")");
        if(!averageEachIteration) {
            runIteration(rdd);
        } else {
            for(NeuralNetConfiguration conf : this.conf.getConfs()) {
                conf.setNumIterations(1);
            }
            for(int i = 0; i < iterations; i++) {
                runIteration(rdd);
            }
            if(iterations > 1 ){
                for(NeuralNetConfiguration conf : this.conf.getConfs()) {
                    conf.setNumIterations(iterations);
                }
            }
        }
        return network;
    }
public MultiLayerNetwork fitDataSet ( JavaRDD < DataSet > rdd ) { int iterations = conf . getConf ( 0 ) . getNumIterations ( ) ; log . info ( "Running distributed training:  (averaging each iteration = " + averageEachIteration + "), (iterations =" + iterations + "), (num partions = " + rdd . partitions ( ) . size ( ) + ")" ) ; if ( ! averageEachIteration ) { runIteration ( rdd ) ; } else { for ( NeuralNetConfiguration conf : this . conf . getConfs ( ) ) { conf . setNumIterations ( 1 ) ; } for ( int i = 0 ; i < iterations ; i ++ ) { runIteration ( rdd ) ; } if ( iterations > 1 ) { for ( NeuralNetConfiguration conf : this . conf . getConfs ( ) ) { conf . setNumIterations ( iterations ) ; } } } return network ; }
Fit the dataset rdd
 @param rdd the rdd to fitDataSet
 @return the multi layer network
Fit the dataset rdd @param rdd the rdd to fitDataSet @return the multi layer network
//Do multiple iterations and average once at the end //Temporarily set numIterations = 1. Control numIterations externall here so we can average between iterations //Run learning, and average at each iteration //Reset number of iterations in config