Module: Neuronet::Yang

Defined in:
lib/neuronet.rb

Overview

sets @out to initially mirror @yang

Class Method Summary collapse

Class Method Details

.bless(myself) ⇒ Object



386
387
388
389
390
391
392
393
394
395
# File 'lib/neuronet.rb', line 386

def self.bless(myself)
  offset = myself.yang.length - (out_length = (out = myself.out).length)
  raise "Last hidden layer, yang, needs to have at least the same length as output" if offset < 0
  0.upto(out_length-1) do |index|
    node = out[index]
    node.connections[offset+index].weight = 1.0
    node.bias = -0.5
  end
  return myself
end