Class: DNN::Losses::MeanAbsoluteError
Instance Method Summary
collapse
#backward, #forward
Methods inherited from Loss
call, #call, #clean, #forward, from_hash, #load_hash, #loss, #regularizers_backward, #regularizers_forward, #to_hash
Instance Method Details
#backward_node(d) ⇒ Object
92
93
94
95
96
97
|
# File 'lib/dnn/core/losses.rb', line 92
def backward_node(d)
dy = @y - @t
dy[dy >= 0] = 1
dy[dy < 0] = -1
dy
end
|
#forward_node(y, t) ⇒ Object
86
87
88
89
90
|
# File 'lib/dnn/core/losses.rb', line 86
def forward_node(y, t)
@y = y
@t = t
(y - t).abs.mean(0).sum
end
|