Class: DNN::Activations::IdentityHuber
Instance Method Summary
collapse
#build, #built?, #initialize, #prev_layer, #shape, #to_hash
Instance Method Details
#backward(y) ⇒ Object
189
190
191
192
193
194
195
196
|
# File 'lib/dnn/core/activations.rb', line 189
def backward(y)
dout = @out - y
if @loss > 1
dout[dout >= 0] = 1
dout[dout < 0] = -1
end
dout
end
|
#forward(x) ⇒ Object
180
181
182
|
# File 'lib/dnn/core/activations.rb', line 180
def forward(x)
@out = x
end
|
#loss(y) ⇒ Object
184
185
186
187
|
# File 'lib/dnn/core/activations.rb', line 184
def loss(y)
loss = loss_l1(y)
@loss = loss > 1 ? loss : loss_l2(y)
end
|