Class: DNN::Optimizers::RMSProp

Inherits:
Optimizer show all
Defined in:
lib/dnn/core/optimizers.rb

Instance Attribute Summary collapse

Attributes inherited from Optimizer

#learning_rate

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Optimizer

#update

Constructor Details

#initialize(learning_rate = 0.001, alpha: 0.9, eps: 1e-7) ⇒ RMSProp

Returns a new instance of RMSProp.

Parameters:

  • (defaults to: 0.001)

    Learning rate.

  • (defaults to: 0.9)

    Moving average index of past slopes.

  • (defaults to: 1e-7)

    Value to avoid division by zero.



139
140
141
142
143
144
# File 'lib/dnn/core/optimizers.rb', line 139

def initialize(learning_rate = 0.001, alpha: 0.9, eps: 1e-7)
  super(learning_rate)
  @alpha = alpha
  @eps = eps
  @g = {}
end

Instance Attribute Details

#alpha ⇒ Float

Return the alpha value.

Returns:

  • Return the alpha value.



128
129
130
# File 'lib/dnn/core/optimizers.rb', line 128

def alpha
  @alpha
end

#eps ⇒ Float

Return the eps value.

Returns:

  • Return the eps value.



130
131
132
# File 'lib/dnn/core/optimizers.rb', line 130

def eps
  @eps
end

Class Method Details

.from_hash(hash) ⇒ Object



132
133
134
# File 'lib/dnn/core/optimizers.rb', line 132

def self.from_hash(hash)
  self.new(hash[:learning_rate], alpha: hash[:alpha], eps: hash[:eps])
end

Instance Method Details

#to_hash ⇒ Object



146
147
148
# File 'lib/dnn/core/optimizers.rb', line 146

def to_hash
  super(alpha: @alpha, eps: @eps)
end