Module: Neuronet::NeuronStats
- Included in:
- InputNeuron, MiddleNeuron, Neuron, OutputNeuron
- Defined in:
- lib/neuronet/neuron_stats.rb
Overview
NeuronStats provides network analysis methods.
Instance Method Summary collapse
-
#downstream_params_tally ⇒ Object
Returns the total tally of parameters in the downstream network subgraph from this neuron.
-
#mju ⇒ Object
Sum of activations + 1.
-
#nju ⇒ Object
Sensitivity measure nju: π ~ ππ + πΎ ππβπβ π β π/π π ~ π + πΎ ππβπβ See the [wiki](github.com/carlosjhr64/neuronet/wiki) See also test/tc_epsilon: github.com/carlosjhr64/neuronet/blob/master/test/tc_epsilon rubocop: disable Metrics.
Instance Method Details
#downstream_params_tally ⇒ Object
Returns the total tally of parameters in the downstream network subgraph from this neuron. This includes the neuronβs bias (1 parameter), the weights of its incoming connections (one per connection), and the sum of parameters from all downstream neurons. Parameters from a shared neuron are counted multiple times if accessed via multiple pathways, reflecting the total parameter influence through all paths. Returns 0 for a neuron with no downstream connections.
15 16 17 18 19 |
# File 'lib/neuronet/neuron_stats.rb', line 15 def downstream_params_tally return 0 if (size = connections.size).zero? 1 + size + connections.sum { it.neuron.downstream_params_tally } end |
#mju ⇒ Object
Sum of activations + 1. Itβs a component of the sensitivity measure nju. See [wiki](github.com/carlosjhr64/neuronet/wiki)
23 |
# File 'lib/neuronet/neuron_stats.rb', line 23 def mju = 1 + connections.sum { it.neuron.activation } |
#nju ⇒ Object
Sensitivity measure nju:
See the [wiki](github.com/carlosjhr64/neuronet/wiki) See also test/tc_epsilon:
https://github.com/carlosjhr64/neuronet/blob/master/test/tc_epsilon
rubocop: disable Metrics
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/neuronet/neuron_stats.rb', line 33 def nju return 0 if connections.empty? mju + connections.sum do |connection| n = connection.neuron next 0.0 if (nju = n.nju).zero? || (a = n.activation).zero? || a >= 1.0 connection.weight * a * (1.0 - a) * nju end end |