Class: Neuronet::OutputNeuron

Inherits:
Object
  • Object
show all
Includes:
Backpropagate, NeuronStats
Defined in:
lib/neuronet/output_neuron.rb

Overview

Output Neuron

Direct Known Subclasses

NoisyOutputNeuron

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Backpropagate

#backpropagate

Methods included from NeuronStats

#downstream_params_tally, #mju, #nju

Constructor Details

#initializeOutputNeuron

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

#biasObject

Returns the value of attribute bias.



14
15
16
# File 'lib/neuronet/output_neuron.rb', line 14

def bias
  @bias
end

#connectionsObject (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

#activationObject



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

#valueObject



23
24
25
# File 'lib/neuronet/output_neuron.rb', line 23

def value
  @bias + @connections.sum(&:value)
end