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
83 84 85 |
# File 'lib/dnn/core/activations.rb', line 83 def backward(y) @out - y end |
#forward(x) ⇒ Object
79 80 81 |
# File 'lib/dnn/core/activations.rb', line 79 def forward(x) @out = x end |
#loss(y) ⇒ Object
87 88 89 90 |
# File 'lib/dnn/core/activations.rb', line 87 def loss(y) batch_size = y.shape[0] 0.5 * ((@out - y)**2).sum / batch_size + ridge end |