Class: DNN::Activations::IdentityHuber
Instance Method Summary
collapse
#build, #built?, #initialize, #prev_layer, #shape, #to_hash
Instance Method Details
#backward(y) ⇒ Object
117
118
119
120
121
122
123
124
|
# File 'lib/dnn/core/activations.rb', line 117
def backward(y)
dout = @out - y
if @loss > 1
dout[dout >= 0] = 1
dout[dout < 0] = -1
end
dout
end
|
#forward(x) ⇒ Object
108
109
110
|
# File 'lib/dnn/core/activations.rb', line 108
def forward(x)
@out = x
end
|
#loss(y) ⇒ Object
112
113
114
115
|
# File 'lib/dnn/core/activations.rb', line 112
def loss(y)
loss = loss_l1(y)
@loss = loss > 1 ? loss : loss_l2(y)
end
|