Class: DNN::Optimizers::AdaGrad

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.01, eps: 1e-7, clip_norm: nil) ⇒ AdaGrad



133
134
135
136
137
138
139
# File 'lib/dnn/core/optimizers.rb', line 133

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

Instance Attribute Details

#epsObject

Returns the value of attribute eps.



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

def eps
  @eps
end

#lrObject

Returns the value of attribute lr.



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

def lr
  @lr
end

Instance Method Details

#load_hash(hash) ⇒ Object



153
154
155
# File 'lib/dnn/core/optimizers.rb', line 153

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

#to_hashObject



149
150
151
# File 'lib/dnn/core/optimizers.rb', line 149

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