Class: NEAT::BasicNeuronTypes::SineNeuron

Inherits:
Neuron show all
Defined in:
lib/rubyneat/neuron.rb

Overview

Sin function (CPPN) – adjusted to have its +1 and -1 near TanhNeuron

Instance Attribute Summary

Attributes inherited from Neuron

#genotype, #heirarchy_number, #output, #trait

Attributes inherited from NeatOb

#controller, #name

Instance Method Summary (collapse)

Methods inherited from Neuron

#bias?, bias?, inherited, input?, #input?, neuron_types, #output?

Methods included from Graph

#<<, #add, #clear_graph, #inputs

Methods inherited from NeatOb

#initialize, #log, log, #to_s

Constructor Details

This class inherits a constructor from NEAT::NeatOb

Instance Method Details

- (Object) express(instance)

create a function on the instance with our name that sums all inputs and produce a sigmoid output (using tanh)



133
134
135
136
137
# File 'lib/rubyneat/neuron.rb', line 133

def express(instance)
  instance.define_singleton_method(@name) {|*inputs|
    sin(1.6 * inputs.reduce {|p, q| p + q})
  }
end