Module: Neuronet::Yang
- Defined in:
- lib/neuronet.rb
Overview
Yang is a network wich has its @out layer initially mirroring @yang.
Class Method Summary collapse
Class Method Details
.bless(myself) ⇒ Object
513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'lib/neuronet.rb', line 513 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 # Although the algorithm here is not as described, # the net effect to is pair @out.last with @yang.last, and so on down. 0.upto(out_length-1) do |index| node = out[index] node.connections[offset+index].weight += WONE node.bias += BZERO end return myself end |