Class: DNN::Activations::IdentityWithLoss
- Inherits:
-
OutputLayer
- Object
- DNN::Activations::IdentityWithLoss
- Defined in:
- lib/dnn/core/activations.rb
Instance Method Summary collapse
Instance Method Details
#backward(y) ⇒ Object
81 82 83 |
# File 'lib/dnn/core/activations.rb', line 81 def backward(y) @out - y end |
#forward(x) ⇒ Object
77 78 79 |
# File 'lib/dnn/core/activations.rb', line 77 def forward(x) @out = x end |
#loss(y) ⇒ Object
85 86 87 88 |
# File 'lib/dnn/core/activations.rb', line 85 def loss(y) batch_size = y.shape[0] 0.5 * ((@out - y)**2).sum / batch_size + ridge end |