Class: NEAT::BasicNeuronTypes::SigmoidNeuron

Inherits:
Neuron
  • Object
show all
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

#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)



111
112
113
114
115
# File 'lib/rubyneat/neuron.rb', line 111

def express(instance)
  instance.define_singleton_method(@name) {|*inputs|
    1.0 / (1.0 + exp(-4.9 * inputs.reduce {|p, q| p + q}))
  }
end