Class: Newral::Networks::Layer
- Inherits:
-
Object
- Object
- Newral::Networks::Layer
- Defined in:
- lib/newral/networks/layer.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#neurons ⇒ Object
readonly
Returns the value of attribute neurons.
Instance Method Summary collapse
- #add_neuron(neuron) ⇒ Object
- #biases ⇒ Object
-
#initialize(identifier: nil) ⇒ Layer
constructor
A new instance of Layer.
- #outputs ⇒ Object
- #weights ⇒ Object
Constructor Details
#initialize(identifier: nil) ⇒ Layer
Returns a new instance of Layer.
6 7 8 9 |
# File 'lib/newral/networks/layer.rb', line 6 def initialize( identifier: nil ) @identifier = identifier @neurons = [] end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
4 5 6 |
# File 'lib/newral/networks/layer.rb', line 4 def identifier @identifier end |
#neurons ⇒ Object (readonly)
Returns the value of attribute neurons.
4 5 6 |
# File 'lib/newral/networks/layer.rb', line 4 def neurons @neurons end |
Instance Method Details
#add_neuron(neuron) ⇒ Object
11 12 13 |
# File 'lib/newral/networks/layer.rb', line 11 def add_neuron( neuron ) @neurons << neuron end |
#biases ⇒ Object
19 20 21 |
# File 'lib/newral/networks/layer.rb', line 19 def biases neurons.collect(&:bias) end |
#outputs ⇒ Object
23 24 25 |
# File 'lib/newral/networks/layer.rb', line 23 def outputs neurons.collect(&:output) end |
#weights ⇒ Object
15 16 17 |
# File 'lib/newral/networks/layer.rb', line 15 def weights @neurons.collect(&:weights).flatten end |