Class: Neuronet::OutputLayer
- Inherits:
-
Object
- Object
- Neuronet::OutputLayer
- Includes:
- Arrayable, LayerPresets
- Defined in:
- lib/neuronet/output_layer.rb
Overview
Output Layer
Constant Summary
Constants included from LayerPresets
LayerPresets::BZERO, LayerPresets::WONE
Instance Method Summary collapse
- #connect(layer) ⇒ Object
-
#initialize(length, output_neuron: OutputNeuron) ⇒ OutputLayer
constructor
A new instance of OutputLayer.
- #to_a ⇒ Object
- #values ⇒ Object
Methods included from Arrayable
#[], #each, #each_with_index, #map, #reverse, #size
Methods included from LayerPresets
#antithesis, #average, #mirror, #synthesis
Constructor Details
#initialize(length, output_neuron: OutputNeuron) ⇒ OutputLayer
Returns a new instance of OutputLayer.
9 10 11 |
# File 'lib/neuronet/output_layer.rb', line 9 def initialize(length, output_neuron: OutputNeuron) @layer = Array.new(length) { output_neuron.new } end |
Instance Method Details
#connect(layer) ⇒ Object
13 14 15 16 17 |
# File 'lib/neuronet/output_layer.rb', line 13 def connect(layer) each do |neuron| layer.each { neuron.connect(it) } end end |
#to_a ⇒ Object
23 |
# File 'lib/neuronet/output_layer.rb', line 23 def to_a = @layer |
#values ⇒ Object
19 20 21 |
# File 'lib/neuronet/output_layer.rb', line 19 def values @layer.map(&:value) end |