Class: DNN::Losses::MeanSquaredError
- Inherits:
-
Loss
- Object
- Loss
- DNN::Losses::MeanSquaredError
show all
- Defined in:
- lib/dnn/core/losses.rb
Instance Method Summary
collapse
Methods inherited from Loss
#forward, #regularizes_backward, #to_hash
Instance Method Details
#backward(y) ⇒ Object
46
47
48
|
# File 'lib/dnn/core/losses.rb', line 46
def backward(y)
@out - y
end
|
#loss(out, y) ⇒ Object
40
41
42
43
44
|
# File 'lib/dnn/core/losses.rb', line 40
def loss(out, y)
@out = out
batch_size = y.shape[0]
0.5 * ((out - y)**2).sum / batch_size
end
|