Class: DNN::Losses::MeanSquaredError
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
79
80
81
|
# File 'lib/dnn/core/losses.rb', line 79
def backward_node(d)
d * (@y - @t) / @y.shape[0]
end
|
#forward_node(y, t) ⇒ Object
73
74
75
76
77
|
# File 'lib/dnn/core/losses.rb', line 73
def forward_node(y, t)
@y = y
@t = t
0.5 * ((y - t)**2).mean(0).sum
end
|