neuron (macula_tweann v0.18.1)

View Source

Neural processing unit for TWEANN networks.

The neuron is the fundamental processing element in a neural network. It receives signals from sensors or other neurons, aggregates them, applies an activation function, and forwards the result to connected neurons or actuators.

Neuron Lifecycle

1. Spawned by cortex with initial state 2. Waits for signals from input connections 3. Aggregates all inputs when complete 4. Applies activation function 5. Forwards output to all output connections 6. Repeats from step 2

State

The neuron maintains:

- Input connections with weights - Output connections (PIDs) - Accumulated input signals - Activation function - Aggregation function

Summary

Functions

Request the neuron to backup its current weights.

Send a signal to a neuron.

Initialize the neuron and enter the main loop.

Start a neuron process.

Functions

backup(NeuronPid)

-spec backup(pid()) -> ok.

Request the neuron to backup its current weights.

The neuron will send its weights to the cortex for storage.

forward(NeuronPid, FromPid, Signal)

-spec forward(pid(), pid(), [float()]) -> ok.

Send a signal to a neuron.

Called by sensors or other neurons to forward their output.

init(Opts)

-spec init(map()) -> no_return().

Initialize the neuron and enter the main loop.

start_link(Opts)

-spec start_link(map()) -> {ok, pid()}.

Start a neuron process.

Options: - id - Unique identifier for this neuron - cortex_pid - PID of the controlling cortex - activation_function - Atom naming the activation function (e.g., tanh) - aggregation_function - Atom naming the aggregation function (e.g., dot_product) - input_pids - List of PIDs that send input to this neuron - output_pids - List of PIDs to forward output to - ro_pids - List of recurrent output PIDs - input_weights - Map of PID to list of weight tuples - bias - Bias value for this neuron