Class: Phren::Layer
- Inherits:
-
Object
- Object
- Phren::Layer
- Defined in:
- lib/layer.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#neurons ⇒ Object
readonly
Returns the value of attribute neurons.
Instance Method Summary collapse
-
#initialize(length, id) ⇒ Layer
constructor
A new instance of Layer.
Constructor Details
#initialize(length, id) ⇒ Layer
Returns a new instance of Layer.
7 8 9 10 11 12 13 |
# File 'lib/layer.rb', line 7 def initialize(length, id) @length = length @id = id # num of layer starting from 0. if it's negative neurons are bias @neurons = Array.new(@length) { |i| Neuron.new(@id < 0 ? 1 : 0,[@id, i]) } end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/layer.rb', line 5 def id @id end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
5 6 7 |
# File 'lib/layer.rb', line 5 def length @length end |
#neurons ⇒ Object (readonly)
Returns the value of attribute neurons.
5 6 7 |
# File 'lib/layer.rb', line 5 def neurons @neurons end |