Class: NeuralNetwork::Connection
- Inherits:
-
Object
- Object
- NeuralNetwork::Connection
- Defined in:
- lib/neural_network/connection.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
-
#target ⇒ Object
Returns the value of attribute target.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(source, target) ⇒ Connection
constructor
A new instance of Connection.
- #to_s ⇒ Object
Constructor Details
#initialize(source, target) ⇒ Connection
Returns a new instance of Connection.
5 6 7 8 9 |
# File 'lib/neural_network/connection.rb', line 5 def initialize(source, target) @source = source # neuron @target = target # neuron @weight = 0.4 # rand end |
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
3 4 5 |
# File 'lib/neural_network/connection.rb', line 3 def source @source end |
#target ⇒ Object
Returns the value of attribute target.
3 4 5 |
# File 'lib/neural_network/connection.rb', line 3 def target @target end |
#weight ⇒ Object
Returns the value of attribute weight.
3 4 5 |
# File 'lib/neural_network/connection.rb', line 3 def weight @weight end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/neural_network/connection.rb', line 11 def to_s "Connection: #{@source} #{@target} #{@weight}" end |