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?

Methods included from Graph

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

Methods inherited from NeatOb

#log, log, #to_s

Constructor Details

- (BiasNeuron) initialize(c = nil, n = nil)

Returns a new instance of BiasNeuron



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

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

Instance Attribute Details

- (Object) neu_bias

Returns the value of attribute neu_bias



91
92
93
# File 'lib/rubyneat/neuron.rb', line 91

def neu_bias
  @neu_bias
end

Class Method Details

+ (Boolean) bias?

Returns:

  • (Boolean)


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

def self.bias? ; true ; end

Instance Method Details

- (Object) express(instance)

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



101
102
103
# File 'lib/rubyneat/neuron.rb', line 101

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