Class Sgd

    • Constructor Detail

      • Sgd

        public Sgd()
      • Sgd

        public Sgd​(double learningRate)
      • Sgd

        public Sgd​(ISchedule learningRateSchedule)
    • Method Detail

      • stateSize

        public long stateSize​(long numParams)
        Description copied from interface: IUpdater
        Determine the updater state size for the given number of parameters. Usually a integer multiple (0,1 or 2) times the number of parameters in a layer.
        Specified by:
        stateSize in interface IUpdater
        Parameters:
        numParams - Number of parameters
        Returns:
        Updater state size for the given number of parameters
      • instantiate

        public GradientUpdater instantiate​(INDArray viewArray,
                                           boolean initializeViewArray)
        Description copied from interface: IUpdater
        Create a new gradient updater
        Specified by:
        instantiate in interface IUpdater
        Parameters:
        viewArray - The updater state size view away
        initializeViewArray - If true: initialise the updater state
        Returns:
      • getLearningRate

        public double getLearningRate​(int iteration,
                                      int epoch)
        Description copied from interface: IUpdater
        Get the learning rate - if any - for the updater, at the specified iteration and epoch. Note that if no learning rate is applicable (AdaDelta, NoOp updaters etc) then Double.NaN should be return
        Specified by:
        getLearningRate in interface IUpdater
        Parameters:
        iteration - Iteration at which to get the learning rate
        epoch - Epoch at which to get the learning rate
        Returns:
        Learning rate, or Double.NaN if no learning rate is applicable for this updater
      • hasLearningRate

        public boolean hasLearningRate()
        Specified by:
        hasLearningRate in interface IUpdater
        Returns:
        True if the updater has a learning rate hyperparameter, false otherwise
      • setLrAndSchedule

        public void setLrAndSchedule​(double lr,
                                     ISchedule lrSchedule)
        Description copied from interface: IUpdater
        Set the learning rate and schedule. Note: may throw an exception if IUpdater.hasLearningRate() returns false.
        Specified by:
        setLrAndSchedule in interface IUpdater
        Parameters:
        lr - Learning rate to set (typically not used if LR schedule is non-null)
        lrSchedule - Learning rate schedule to set (may be null)