Class: DNN::Optimizers::AdaGrad
- Defined in:
- lib/dnn/core/optimizers.rb
Instance Attribute Summary collapse
-
#eps ⇒ Object
Returns the value of attribute eps.
-
#lr ⇒ Object
Returns the value of attribute lr.
Attributes inherited from Optimizer
Instance Method Summary collapse
-
#initialize(lr: 0.01, eps: 1e-7, clip_norm: nil) ⇒ AdaGrad
constructor
A new instance of AdaGrad.
- #load_hash(hash) ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Optimizer
from_hash, #update, #update_layers
Constructor Details
#initialize(lr: 0.01, eps: 1e-7, clip_norm: nil) ⇒ AdaGrad
Returns a new instance of AdaGrad.
118 119 120 121 122 123 |
# File 'lib/dnn/core/optimizers.rb', line 118 def initialize(lr: 0.01, eps: 1e-7, clip_norm: nil) super(clip_norm: clip_norm) @lr = lr @eps = eps @g = {} end |
Instance Attribute Details
#eps ⇒ Object
Returns the value of attribute eps.
114 115 116 |
# File 'lib/dnn/core/optimizers.rb', line 114 def eps @eps end |
#lr ⇒ Object
Returns the value of attribute lr.
113 114 115 |
# File 'lib/dnn/core/optimizers.rb', line 113 def lr @lr end |
Instance Method Details
#load_hash(hash) ⇒ Object
137 138 139 |
# File 'lib/dnn/core/optimizers.rb', line 137 def load_hash(hash) initialize(lr: hash[:lr], eps: hash[:eps], clip_norm: hash[:clip_norm]) end |
#to_hash ⇒ Object
133 134 135 |
# File 'lib/dnn/core/optimizers.rb', line 133 def to_hash super(lr: @lr, eps: @eps) end |