class RubyBrain::Layer
Attributes
input_weights[RW]
next_node_order_index[R]
nodes[R]
output_weights[RW]
Public Class Methods
new()
click to toggle source
# File lib/ruby_brain/layer.rb, line 6 def initialize @nodes = [] @next_node_order_index = 0 end
Public Instance Methods
append(node)
click to toggle source
# File lib/ruby_brain/layer.rb, line 11 def append(node) node.order_index = @next_node_order_index node.left_side_weights = @input_weights node.right_side_weights = @output_weights @nodes << node @next_node_order_index += 1 end
backward_outputs(inputs)
click to toggle source
# File lib/ruby_brain/layer.rb, line 33 def backward_outputs(inputs) @nodes.map { |node| node.output_of_backward_calc(inputs) }.compact end
each_node() { |node| ... }
click to toggle source
# File lib/ruby_brain/layer.rb, line 23 def each_node @nodes.each do |node| yield node end end
forward_outputs(inputs=[])
click to toggle source
# File lib/ruby_brain/layer.rb, line 29 def forward_outputs(inputs=[]) @nodes.map { |node| node.output_of_forward_calc(inputs) } end
num_nodes()
click to toggle source
# File lib/ruby_brain/layer.rb, line 19 def num_nodes @nodes.size end