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
77 78 79 |
# File 'lib/dnn/core/activations.rb', line 77 def backward(y) @out - y end |
#forward(x) ⇒ Object
73 74 75 |
# File 'lib/dnn/core/activations.rb', line 73 def forward(x) @out = x end |
#loss(y) ⇒ Object
81 82 83 |
# File 'lib/dnn/core/activations.rb', line 81 def loss(y) 0.5 * ((@out - y) ** 2).sum / @model.batch_size + ridge end |