Class: Ai::Neat::Network
- Inherits:
-
Object
- Object
- Ai::Neat::Network
- Defined in:
- lib/ai/neat/network.rb
Instance Attribute Summary collapse
-
#layers ⇒ Object
Returns the value of attribute layers.
Instance Method Summary collapse
- #feed_forward ⇒ Object
-
#initialize(models) ⇒ Network
constructor
A new instance of Network.
Constructor Details
#initialize(models) ⇒ Network
Returns a new instance of Network.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ai/neat/network.rb', line 8 def initialize(models) @layers = [] models.each do |model| @layers.push(Layer.new(model[:node_count], model[:node_type], model[:activationfunc])) end (0..(@layers.count - 2)).each do |i| @layers[i].connect(@layers[i + 1].nodes.count) end end |
Instance Attribute Details
#layers ⇒ Object
Returns the value of attribute layers.
6 7 8 |
# File 'lib/ai/neat/network.rb', line 6 def layers @layers end |
Instance Method Details
#feed_forward ⇒ Object
20 21 22 23 24 |
# File 'lib/ai/neat/network.rb', line 20 def feed_forward (0..(@layers.count - 2)).each do |i| @layers[i].feed_forward(@layers[i + 1]) end end |