Class: Neuronet::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/neuronet.rb

Overview

A Node, used for the input layer.

Direct Known Subclasses

Neuron

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val = 0.0) ⇒ Node

Returns a new instance of Node.



34
35
36
# File 'lib/neuronet.rb', line 34

def initialize(val=0.0)
  self.value = val
end

Instance Attribute Details

#activationObject (readonly) Also known as: update

Returns the value of attribute activation.



25
26
27
# File 'lib/neuronet.rb', line 25

def activation
  @activation
end

Instance Method Details

#backpropagate(error) ⇒ Object

Node is a terminal where backpropagation ends.



44
45
46
47
# File 'lib/neuronet.rb', line 44

def backpropagate(error)
  # to be over-ridden
  nil
end

#valueObject

The “real world” value is stored as a squashed activation.



39
40
41
# File 'lib/neuronet.rb', line 39

def value
  Neuronet.unsquash(@activation)
end

#value=(val) ⇒ Object

The “real world” value of a node is the value of it’s activation unsquashed.



30
31
32
# File 'lib/neuronet.rb', line 30

def value=(val)
  @activation = Neuronet.squash(val)
end