Class: Neuronet::OutputLayer

Inherits:
Object
  • Object
show all
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

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_aObject



23
# File 'lib/neuronet/output_layer.rb', line 23

def to_a = @layer

#valuesObject



19
20
21
# File 'lib/neuronet/output_layer.rb', line 19

def values
  @layer.map(&:value)
end