Class: DNN::Optimizers::RMSProp

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

Instance Attribute Summary collapse

Attributes inherited from Optimizer

#clip_norm

Instance Method Summary collapse

Methods inherited from Optimizer

from_hash, #update, #update_layers

Constructor Details

#initialize(lr: 0.001, alpha: 0.9, eps: 1e-7, clip_norm: nil) ⇒ RMSProp

Returns a new instance of RMSProp.

Parameters:

  • lr (Float) (defaults to: 0.001)

    Learning rate.

  • alpha (Float) (defaults to: 0.9)

    Moving average index of past slopes.

  • eps (Float) (defaults to: 1e-7)

    Value to avoid division by zero.



150
151
152
153
154
155
156
# File 'lib/dnn/core/optimizers.rb', line 150

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

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



144
145
146
# File 'lib/dnn/core/optimizers.rb', line 144

def alpha
  @alpha
end

#epsObject

Returns the value of attribute eps.



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

def eps
  @eps
end

#lrObject

Returns the value of attribute lr.



143
144
145
# File 'lib/dnn/core/optimizers.rb', line 143

def lr
  @lr
end

Instance Method Details

#load_hash(hash) ⇒ Object



170
171
172
# File 'lib/dnn/core/optimizers.rb', line 170

def load_hash(hash)
  initialize(lr: hash[:lr], alpha: hash[:alpha], eps: hash[:eps], clip_norm: hash[:clip_norm])
end

#to_hashObject



158
159
160
# File 'lib/dnn/core/optimizers.rb', line 158

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