Class: NEAT::BasicNeuronTypes::BiasNeuron

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

Overview

Special class of neuron that provides a bias signal.

FIXME: The bias value is not behaving as expected because FIXME: the instance is not the neuron, but the phenotype.

Instance Attribute Summary collapse

Attributes inherited from Neuron

#genotype, #heirarchy_number, #output, #trait

Attributes inherited from NeatOb

#controller, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from InputNeuron

input?

Methods inherited from Neuron

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

Methods included from Graph

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

Methods inherited from NeatOb

attr_neat, log, #log, #to_s

Constructor Details

#initialize(c = nil, n = nil) ⇒ BiasNeuron

Returns a new instance of BiasNeuron.



98
99
100
101
# File 'lib/rubyneat/neuron.rb', line 98

def initialize(c=nil, n=nil)
  super
  @neu_bias = 1.00
end

Instance Attribute Details

#neu_biasObject

Returns the value of attribute neu_bias.



96
97
98
# File 'lib/rubyneat/neuron.rb', line 96

def neu_bias
  @neu_bias
end

Class Method Details

.bias?Boolean

Returns:

  • (Boolean)


95
# File 'lib/rubyneat/neuron.rb', line 95

def self.bias? ; true ; end

Instance Method Details

#express(instance) ⇒ Object

Just provides a bias signal FIXME: we had to hard-code the value here for now. Not a biggie, FIXME: but really should be @neu_bias



106
107
108
# File 'lib/rubyneat/neuron.rb', line 106

def express(instance)
  instance.define_singleton_method(@name) { 1.00 }
end