Class: Neuronet::InputLayer

Inherits:
Array
  • Object
show all
Defined in:
lib/neuronet.rb

Overview

Neuronet::InputLayer is an Array of Neuronet::Node’s. It can be used for the input layer of a feed forward network.

Instance Method Summary collapse

Constructor Details

#initialize(length) ⇒ InputLayer

number of nodes



171
172
173
174
# File 'lib/neuronet.rb', line 171

def initialize(length) # number of nodes
  super(length)
  0.upto(length-1){|index| self[index] = Neuronet::Node.new }
end

Instance Method Details

#set(inputs) ⇒ Object

This is where one enters the “real world” inputs.



177
178
179
# File 'lib/neuronet.rb', line 177

def set(inputs)
  0.upto(self.length-1){|index| self[index].value = inputs[index]}
end