Class: DNN::Regularizers::L1
- Inherits:
-
Regularizer
- Object
- Regularizer
- DNN::Regularizers::L1
- Defined in:
- lib/dnn/core/regularizers.rb
Instance Attribute Summary
Attributes inherited from Regularizer
Instance Method Summary collapse
- #forward(x) ⇒ Object
-
#initialize(l1_lambda = 0.01) ⇒ L1
constructor
A new instance of L1.
- #l1_lambda ⇒ Object
- #l1_lambda=(lam) ⇒ Object
- #load_hash(hash) ⇒ Object
- #to_hash ⇒ Object
Methods inherited from Regularizer
Constructor Details
Instance Method Details
#forward(x) ⇒ Object
37 38 39 |
# File 'lib/dnn/core/regularizers.rb', line 37 def forward(x) x + @l1.(@param) end |
#l1_lambda ⇒ Object
41 42 43 |
# File 'lib/dnn/core/regularizers.rb', line 41 def l1_lambda @l1.l1_lambda end |
#l1_lambda=(lam) ⇒ Object
45 46 47 |
# File 'lib/dnn/core/regularizers.rb', line 45 def l1_lambda=(lam) @l1.l1_lambda = lam end |
#load_hash(hash) ⇒ Object
53 54 55 |
# File 'lib/dnn/core/regularizers.rb', line 53 def load_hash(hash) initialize(hash[:l1_lambda]) end |
#to_hash ⇒ Object
49 50 51 |
# File 'lib/dnn/core/regularizers.rb', line 49 def to_hash super(l1_lambda: l1_lambda) end |