class CooCoo::ActivationFunctions::Normalize
Public Instance Methods
call(x)
click to toggle source
# File lib/coo-coo/activation_functions.rb, line 293 def call(x) if x.respond_to?(:normalize) x.normalize else x.coerce(0) end end
derivative(x, y = nil)
click to toggle source
# File lib/coo-coo/activation_functions.rb, line 301 def derivative(x, y = nil) mag = x.magnitude() y ||= call(x) 1.0 / mag - y * y / mag end
prep_output_target(x)
click to toggle source
# File lib/coo-coo/activation_functions.rb, line 307 def prep_output_target(x) x.normalize end