Class: CooCoo::ActivationFunctions::Logistic

Inherits:
Identity show all
Defined in:
lib/coo-coo/activation_functions.rb

Instance Method Summary collapse

Methods inherited from Identity

#initial_bias, #initial_weights, method_missing, #name, #prep_input, #prep_output_target, #to_s

Instance Method Details

#call(x) ⇒ Object



93
94
95
# File 'lib/coo-coo/activation_functions.rb', line 93

def call(x)
  1.0 / ( 1.0 + (-x).exp)
end

#derivative(x, y = nil) ⇒ Object



97
98
99
100
# File 'lib/coo-coo/activation_functions.rb', line 97

def derivative(x, y = nil)
  y ||= call(x)
  y * (1.0 - y)
end