Class: DNN::Activations::SigmoidWithLoss
- Inherits:
-
Layers::OutputLayer
- Object
- Layers::Layer
- Layers::OutputLayer
- DNN::Activations::SigmoidWithLoss
- Defined in:
- lib/dnn/core/activations.rb
Constant Summary collapse
- NMath =
Xumo::NMath
Instance Method Summary collapse
- #backward(y) ⇒ Object
- #forward(x) ⇒ Object
-
#initialize ⇒ SigmoidWithLoss
constructor
A new instance of SigmoidWithLoss.
- #loss(y) ⇒ Object
Methods inherited from Layers::Layer
#build, #built?, #prev_layer, #shape, #to_hash
Constructor Details
#initialize ⇒ SigmoidWithLoss
Returns a new instance of SigmoidWithLoss.
244 245 246 |
# File 'lib/dnn/core/activations.rb', line 244 def initialize @sigmoid = Sigmoid.new end |
Instance Method Details
#backward(y) ⇒ Object
252 253 254 |
# File 'lib/dnn/core/activations.rb', line 252 def backward(y) @out - y end |
#forward(x) ⇒ Object
248 249 250 |
# File 'lib/dnn/core/activations.rb', line 248 def forward(x) @out = @sigmoid.forward(x) end |