All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.deeplearning4j.spark.impl.paramavg.ParameterAveragingTrainingResult Maven / Gradle / Ivy

There is a newer version: 1.0.0-beta_spark_2
Show newest version
package org.deeplearning4j.spark.impl.paramavg;

import lombok.Data;
import org.deeplearning4j.api.storage.Persistable;
import org.deeplearning4j.api.storage.StorageMetaData;
import org.deeplearning4j.spark.api.TrainingResult;
import org.deeplearning4j.spark.api.stats.SparkTrainingStats;
import org.nd4j.linalg.api.ndarray.INDArray;

import java.util.Collection;

/**
 * The results (parameters, optional updaters) returned by a {@link ParameterAveragingTrainingWorker} to the
 * {@link ParameterAveragingTrainingMaster}
 *
 * @author Alex Black
 */
@Data
public class ParameterAveragingTrainingResult implements TrainingResult {

    private final INDArray parameters;
    private final INDArray updaterState;
    private final double score;
    private SparkTrainingStats sparkTrainingStats;

    private final Collection listenerMetaData;
    private final Collection listenerStaticInfo;
    private final Collection listenerUpdates;


    public ParameterAveragingTrainingResult(INDArray parameters, INDArray updaterState, double score, Collection listenerMetaData,
                                            Collection listenerStaticInfo, Collection listenerUpdates){
        this(parameters, updaterState, score, null, listenerMetaData, listenerStaticInfo, listenerUpdates);
    }

    public ParameterAveragingTrainingResult(INDArray parameters, INDArray updaterState, double score, SparkTrainingStats sparkTrainingStats,
                                            Collection listenerMetaData, Collection listenerStaticInfo,
                                            Collection listenerUpdates){
        this.parameters = parameters;
        this.updaterState = updaterState;
        this.score = score;
        this.sparkTrainingStats = sparkTrainingStats;

        this.listenerMetaData = listenerMetaData;
        this.listenerStaticInfo = listenerStaticInfo;
        this.listenerUpdates = listenerUpdates;
    }

    @Override
    public void setStats(SparkTrainingStats sparkTrainingStats) {
        this.sparkTrainingStats = sparkTrainingStats;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy