class CooCoo::ActivationFunctions::TanH

Public Instance Methods

call(x) click to toggle source
# File lib/coo-coo/activation_functions.rb, line 106
def call(x)
  2.0 / (1.0 + (x * -2.0).exp) - 1.0
end
derivative(x, y = nil) click to toggle source
# File lib/coo-coo/activation_functions.rb, line 110
def derivative(x, y = nil)
  y ||= call(x)
  1.0 - y * y
end
initial_bias(size) click to toggle source
# File lib/coo-coo/activation_functions.rb, line 115
def initial_bias(size)
  CooCoo::Vector.zeros(size)
end
prep_input(arr) click to toggle source
# File lib/coo-coo/activation_functions.rb, line 119
def prep_input(arr)
  (arr.minmax_normalize(true) * 2.0) - 1.0
end
prep_output_target(arr) click to toggle source
# File lib/coo-coo/activation_functions.rb, line 123
def prep_output_target(arr)
  prep_input(arr)
end