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, #status

Instance Method Summary collapse

Methods inherited from Optimizer

#dump, from_hash, load, #update

Constructor Details

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



166
167
168
169
170
171
172
173
# File 'lib/dnn/core/optimizers.rb', line 166

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 = {}
  @status = { g: @g }
end

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



160
161
162
# File 'lib/dnn/core/optimizers.rb', line 160

def alpha
  @alpha
end

#epsObject

Returns the value of attribute eps.



161
162
163
# File 'lib/dnn/core/optimizers.rb', line 161

def eps
  @eps
end

#lrObject

Returns the value of attribute lr.



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

def lr
  @lr
end

Instance Method Details

#load_hash(hash) ⇒ Object



187
188
189
# File 'lib/dnn/core/optimizers.rb', line 187

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

#to_hashObject



175
176
177
# File 'lib/dnn/core/optimizers.rb', line 175

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