Class: NEAT::BasicNeuronTypes::SigmoidNeuron
- Defined in:
- lib/rubyneat/neuron.rb
Overview
The most commonly-used neuron for the hidden and output layers. We use the Logistic Function for the Sigmoid.
Instance Attribute Summary
Attributes inherited from Neuron
#genotype, #heirarchy_number, #output, #trait
Attributes inherited from NeatOb
Instance Method Summary collapse
-
#express(instance) ⇒ Object
create a function on the instance with our name that sums all inputs and produce a sigmoid output (using tanh).
Methods inherited from Neuron
#bias?, bias?, inherited, input?, #input?, neuron_types, #output?, type_name
Methods included from Graph
#<<, #add, #clear_graph, #inputs
Methods inherited from NeatOb
attr_neat, #initialize, log, #log, #to_s
Constructor Details
This class inherits a constructor from NEAT::NeatOb
Instance Method Details
#express(instance) ⇒ Object
create a function on the instance with our name that sums all inputs and produce a sigmoid output (using tanh)
116 117 118 119 120 |
# File 'lib/rubyneat/neuron.rb', line 116 def express(instance) instance.define_singleton_method(@name) {|*inputs| 1.0 / (1.0 + exp(-4.9 * inputs.reduce {|p, q| p + q})) } end |