Class: DNN::Optimizers::RMSPropGraves

Inherits:
Optimizer
  • Object
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.0001, alpha: 0.95, eps: 0.0001, clip_norm: nil) ⇒ RMSPropGraves

Returns a new instance of RMSPropGraves.

Parameters:

  • lr (Float) (defaults to: 0.0001) —

    Learning rate.

  • alpha (Float) (defaults to: 0.95) —

    Moving average index of past slopes.

  • eps (Float) (defaults to: 0.0001) —

    Value to avoid division by zero.



238
239
240
241
242
243
244
245
246
# File 'lib/dnn/core/optimizers.rb', line 238

def initialize(lr = 0.0001, alpha: 0.95, eps: 0.0001, clip_norm: nil)
  super(clip_norm: clip_norm)
  @lr = lr
  @alpha = alpha
  @eps = eps
  @m = {}
  @v = {}
  @status = { m: @m, v: @v }
end

Instance Attribute Details

#alpha ⇒ Object

Returns the value of attribute alpha.



232
233
234
# File 'lib/dnn/core/optimizers.rb', line 232

def alpha
  @alpha
end

#eps ⇒ Object

Returns the value of attribute eps.



233
234
235
# File 'lib/dnn/core/optimizers.rb', line 233

def eps
  @eps
end

#lr ⇒ Object

Returns the value of attribute lr.



231
232
233
# File 'lib/dnn/core/optimizers.rb', line 231

def lr
  @lr
end

Instance Method Details

#load_hash(hash) ⇒ Object



262
263
264
# File 'lib/dnn/core/optimizers.rb', line 262

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

#to_hash ⇒ Object



248
249
250
# File 'lib/dnn/core/optimizers.rb', line 248

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