class DNN::Regularizers::L1

Public Class Methods

new(l1_lambda = 0.01) click to toggle source

@param [Float] l1_lambda L1 regularizer coefficient.

# File lib/dnn/core/regularizers.rb, line 33
def initialize(l1_lambda = 0.01)
  @l1 = Layers::Lasso.new(l1_lambda)
end

Public Instance Methods

forward(x) click to toggle source
# File lib/dnn/core/regularizers.rb, line 37
def forward(x)
  x + @l1.(@param)
end
l1_lambda() click to toggle source
# File lib/dnn/core/regularizers.rb, line 41
def l1_lambda
  @l1.l1_lambda
end
l1_lambda=(lam) click to toggle source
# File lib/dnn/core/regularizers.rb, line 45
def l1_lambda=(lam)
  @l1.l1_lambda = lam
end
load_hash(hash) click to toggle source
# File lib/dnn/core/regularizers.rb, line 53
def load_hash(hash)
  initialize(hash[:l1_lambda])
end
to_hash() click to toggle source
Calls superclass method DNN::Regularizers::Regularizer#to_hash
# File lib/dnn/core/regularizers.rb, line 49
def to_hash
  super(l1_lambda: l1_lambda)
end