Class: DNN::Activations::Sigmoid

Inherits:
Layers::Layer show all
Defined in:
lib/dnn/core/activations.rb

Instance Attribute Summary

Attributes inherited from Layers::Layer

#input_shape, #learning_phase

Instance Method Summary collapse

Methods inherited from Layers::Layer

#build, #built?, #initialize, #output_shape, #to_hash

Constructor Details

This class inherits a constructor from DNN::Layers::Layer

Instance Method Details

#backward(dy) ⇒ Object



9
10
11
# File 'lib/dnn/core/activations.rb', line 9

def backward(dy)
  dy * (1 - @y) * @y
end

#forward(x) ⇒ Object



5
6
7
# File 'lib/dnn/core/activations.rb', line 5

def forward(x)
  @y = 1 / (1 + NMath.exp(-x))
end