class NEAT::BasicNeuronTypes::GaussianNeuron

Gaussian function (CPPN) – SD 1 of inputs

Public Instance Methods

express(instance) click to toggle source

create a function on the instance with our name that sums all inputs and produce a gaussian of standard deviation of 1.

# File lib/rubyneat/neuron.rb, line 172
def express(instance)
  instance.define_singleton_method(@name) { |*inputs|
    a = 1.0 #height
    b = 0.0 #center
    c = 1.0 #SD
    d = 0.0 #lowest y point
    x = inputs.reduce {|p, q| p + q}
    a * exp(-(x - b)**2.0 / 2*c**2.0) + d
  }
end