Module: Neuronet::Yin

Defined in:
lib/neuronet.rb

Overview

Yin is a network which has its @yin layer initially mirroring @in.

Class Method Summary collapse

Class Method Details

.bless(myself) ⇒ Object

Yin.bless increments the bias of each @yin by BZERO, and the weight of pairing (@yin, @in) connections by WONE. This makes @yin initially mirror @in. The pairing is done starting with (@yin, @in). That is, starting with (@yin.first, @in.first).



491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/neuronet.rb', line 491

def self.bless(myself)
  yin = myself.yin
  if yin.length < (in_length = myself.in.length)
    raise "First hidden layer, yin, needs to have at least the same length as input"
  end
  # connections from yin[i] to in[i] are WONE... mirroring to start.
  0.upto(in_length-1) do |index|
    node = yin[index]
    node.connections[index].weight += WONE
    node.bias += BZERO
  end
  return myself
end