class SimpleNeuralNetwork::Neuron
Constants
- EDGE_RANGE
Define the minimum and maximum edge weight
Attributes
bias[RW]
edges[RW]
A neuron's edges connect it to the #{layer.next_layer.size} neurons of the next layer
layer[RW]
The neuron parent layer
Public Class Methods
new(layer)
click to toggle source
# File lib/neuron.rb, line 14 def initialize(layer) @layer = layer @bias = 0 @edges = [] @value = nil end
Public Instance Methods
initialize_edges(next_layer_size)
click to toggle source
A neuron should have one edge per neuron in the next layer
# File lib/neuron.rb, line 22 def initialize_edges(next_layer_size) next_layer_size.times do @edges << rand(EDGE_RANGE) end end