Class: NEAT::BasicNeuronTypes::CosineNeuron

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

Overview

Cosine function (CPPN) – adjusted to have its +1 and -1 near TanhNeuron

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)



144
145
146
147
148
# File 'lib/rubyneat/neuron.rb', line 144

def express(instance)
  instance.define_singleton_method(@name) {|*inputs|
    cos(1.6 * inputs.reduce {|p, q| p + q})
  }
end