Class: NEAT::Neuron
- Inherits:
-
NeatOb
- Object
- NeatOb
- NEAT::Neuron
- Includes:
- Math, Graph
- Defined in:
- lib/rubyneat/neuron.rb
Overview
Neuron – Basis of all Neat Neuron types.
Normally contains primatives which aids in its own expression, but the details of this remains to be worked out.
Direct Known Subclasses
BasicNeuronTypes::CosineNeuron, BasicNeuronTypes::InputNeuron, BasicNeuronTypes::SigmoidNeuron, BasicNeuronTypes::SineNeuron, BasicNeuronTypes::TanhNeuron
Constant Summary
- @@neuron_types =
List of neuron types defined.
[]
Instance Attribute Summary (collapse)
-
- (Object) genotype
readonly
Genotype to which we belong.
-
- (Object) heirarchy_number
(assigned by wire!) Heirarchy number in the Genome / Critter We need this to assure we add genes in the proper order.
-
- (Object) output
This is true if this is an output neuron.
-
- (Object) trait
Returns the value of attribute trait.
Attributes inherited from NeatOb
Class Method Summary (collapse)
- + (Boolean) bias?
- + (Object) inherited(clazz)
-
+ (Boolean) input?
Class is is of Input type?.
-
+ (Object) neuron_types
List of distinct neuron types (classes).
Instance Method Summary (collapse)
- - (Boolean) bias?
-
- (Object) express(instance)
Function must be implemented by subclasses for phenotype generation.
- - (Boolean) input?
-
- (Boolean) output?
Instantiation is of outout type?.
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 Attribute Details
- (Object) genotype (readonly)
Genotype to which we belong
19 20 21 |
# File 'lib/rubyneat/neuron.rb', line 19 def genotype @genotype end |
- (Object) heirarchy_number
(assigned by wire!) Heirarchy number in the Genome / Critter We need this to assure we add genes in the proper order. This will be recalculated every time a new neuron is added.
25 26 27 |
# File 'lib/rubyneat/neuron.rb', line 25 def heirarchy_number @heirarchy_number end |
- (Object) output
This is true if this is an output neuron.
28 29 30 |
# File 'lib/rubyneat/neuron.rb', line 28 def output @output end |
- (Object) trait
Returns the value of attribute trait
20 21 22 |
# File 'lib/rubyneat/neuron.rb', line 20 def trait @trait end |
Class Method Details
+ (Boolean) bias?
37 |
# File 'lib/rubyneat/neuron.rb', line 37 def self.bias? ; false ; end |
+ (Object) inherited(clazz)
43 44 45 |
# File 'lib/rubyneat/neuron.rb', line 43 def self.inherited(clazz) @@neuron_types << clazz end |
+ (Boolean) input?
Class is is of Input type?
34 |
# File 'lib/rubyneat/neuron.rb', line 34 def self.input? ; false ; end |
+ (Object) neuron_types
List of distinct neuron types (classes)
48 |
# File 'lib/rubyneat/neuron.rb', line 48 def self.neuron_types; @@neuron_types ; end |
Instance Method Details
- (Boolean) bias?
38 |
# File 'lib/rubyneat/neuron.rb', line 38 def bias? ; self.class.bias? ; end |
- (Object) express(instance)
Function must be implemented by subclasses for phenotype generation. Basically, an instance is passed to this function and it will add a function to sum all inputs and a apply an operator to the sum.
54 55 56 |
# File 'lib/rubyneat/neuron.rb', line 54 def express(instance) raise NeatException.new "express() must be implemented by subclass." end |
- (Boolean) input?
35 |
# File 'lib/rubyneat/neuron.rb', line 35 def input? ; self.class.input? ; end |
- (Boolean) output?
Instantiation is of outout type?
41 |
# File 'lib/rubyneat/neuron.rb', line 41 def output? ; !!@output ; end |