Class: NN::Sigmoid

Inherits:
Object
  • Object
show all
Defined in:
lib/nn.rb

Instance Method Summary collapse

Instance Method Details

#backward(dout) ⇒ Object



309
310
311
# File 'lib/nn.rb', line 309

def backward(dout)
  dout * (1.0 - @out) * @out
end

#forward(x) ⇒ Object



305
306
307
# File 'lib/nn.rb', line 305

def forward(x)
  @out = 1.0 / (1 + Numo::NMath.exp(-x))
end