Class: Ai::Neat::Node
- Inherits:
-
Object
- Object
- Ai::Neat::Node
- Defined in:
- lib/ai/neat/node.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
-
#weights ⇒ Object
Returns the value of attribute weights.
Instance Method Summary collapse
-
#initialize ⇒ Node
constructor
A new instance of Node.
- #initWeights(count) ⇒ Object
Constructor Details
#initialize ⇒ Node
Returns a new instance of Node.
8 9 10 11 |
# File 'lib/ai/neat/node.rb', line 8 def initialize @value = 0 @weights = [] end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/ai/neat/node.rb', line 6 def value @value end |
#weights ⇒ Object
Returns the value of attribute weights.
6 7 8 |
# File 'lib/ai/neat/node.rb', line 6 def weights @weights end |
Instance Method Details
#initWeights(count) ⇒ Object
13 14 15 16 17 |
# File 'lib/ai/neat/node.rb', line 13 def initWeights(count) (1..count).each do |_i| weights.push(rand(-1.0..1.0)) end end |