Class: DNN::Activations::SigmoidWithLoss
- Inherits:
-
OutputLayer
- Object
- DNN::Activations::SigmoidWithLoss
- Includes:
- SigmoidFunction, Numo
- Defined in:
- lib/dnn/core/activations.rb
Instance Method Summary collapse
Methods included from SigmoidFunction
Instance Method Details
#backward(y) ⇒ Object
106 107 108 |
# File 'lib/dnn/core/activations.rb', line 106 def backward(y) @out - y end |
#loss(y) ⇒ Object
110 111 112 |
# File 'lib/dnn/core/activations.rb', line 110 def loss(y) -(y * NMath.log(@out + 1e-7) + (1 - y) * NMath.log(1 - @out + 1e-7)).sum / @model.batch_size + ridge end |