Class: Neuronet::OutputNeuron
- Inherits:
-
Object
- Object
- Neuronet::OutputNeuron
- Includes:
- Backpropagate, NeuronStats
- Defined in:
- lib/neuronet/output_neuron.rb
Overview
Output Neuron
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bias ⇒ Object
Returns the value of attribute bias.
-
#connections ⇒ Object
readonly
Returns the value of attribute connections.
Instance Method Summary collapse
- #activation ⇒ Object
- #connect(neuron, weight = 0.0) ⇒ Object
-
#initialize ⇒ OutputNeuron
constructor
A new instance of OutputNeuron.
- #value ⇒ Object
Methods included from Backpropagate
Methods included from NeuronStats
#downstream_params_tally, #mju, #nju
Constructor Details
#initialize ⇒ OutputNeuron
Returns a new instance of OutputNeuron.
9 10 11 12 |
# File 'lib/neuronet/output_neuron.rb', line 9 def initialize @bias = 0.0 @connections = [] end |
Instance Attribute Details
#bias ⇒ Object
Returns the value of attribute bias.
14 15 16 |
# File 'lib/neuronet/output_neuron.rb', line 14 def bias @bias end |
#connections ⇒ Object (readonly)
Returns the value of attribute connections.
15 16 17 |
# File 'lib/neuronet/output_neuron.rb', line 15 def connections @connections end |
Instance Method Details
#activation ⇒ Object
17 |
# File 'lib/neuronet/output_neuron.rb', line 17 def activation = nil |
#connect(neuron, weight = 0.0) ⇒ Object
19 20 21 |
# File 'lib/neuronet/output_neuron.rb', line 19 def connect(neuron, weight = 0.0) @connections << Connection.new(neuron, weight) end |
#value ⇒ Object
23 24 25 |
# File 'lib/neuronet/output_neuron.rb', line 23 def value @bias + @connections.sum(&:value) end |