class SimpleNeuralNetwork::Neuron
Attributes
bias[RW]
edges[RW]
A neuron's edges connect it to the #{layer.next_layer.size} neurons of the next layer
Public Class Methods
new(layer:)
click to toggle source
# File lib/neuron.rb, line 8 def initialize(layer:) @layer = layer @bias = layer.network.neuron_bias_initialization_function.call @edges = [] 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 15 def initialize_edges(next_layer_size) init_function = @layer.network.edge_initialization_function next_layer_size.times do @edges << init_function.call end end