neuron_ltc (macula_tweann v0.18.1)
View SourceLiquid Time-Constant (LTC) neural processing unit for TWEANN networks.
This module implements LTC neurons that have input-dependent time constants, enabling adaptive temporal processing for time-series data and real-time control tasks.
LTC vs Standard Neurons
Standard neurons: output = f(sum(w_i * x_i) + bias) LTC neurons: maintain internal state x(t) that evolves according to: dx/dt = -[1/tau + f(x,I,theta)] * x + f(x,I,theta) * A
CfC neurons use a fast closed-form approximation: x_new = sigma(-f) * x_old + (1 - sigma(-f)) * h
Neuron Lifecycle
1. Spawned by cortex with initial state (including LTC parameters) 2. Waits for signals from input connections 3. Aggregates all inputs when complete 4. Evaluates LTC dynamics (CfC or ODE) 5. Forwards output to all output connections 6. Maintains internal_state between evaluations 7. Repeats from step 2
State Persistence
Unlike standard neurons which are stateless between evaluations, LTC neurons maintain persistent internal_state that carries information across timesteps. This enables temporal memory and adaptive dynamics.
References
[1] Hasani, R., Lechner, M., et al. (2021). "Liquid Time-constant Networks." Proceedings of the AAAI Conference on Artificial Intelligence.
[2] Hasani, R., Lechner, M., et al. (2022). "Closed-form Continuous-time Neural Networks." Nature Machine Intelligence.
Summary
Functions
Request the neuron to backup its current weights and state.
Send a signal to an LTC neuron.
Get the current internal state of the LTC neuron.
Initialize the LTC neuron and enter the main loop.
Reset the internal state of the LTC neuron to zero.
Start an LTC neuron process.
Functions
-spec backup(pid()) -> ok.
Request the neuron to backup its current weights and state.
The neuron will send its weights and LTC parameters to the cortex.
Send a signal to an LTC neuron.
Called by sensors or other neurons to forward their output.
-spec get_state(pid()) -> ok.
Get the current internal state of the LTC neuron.
Returns the internal state asynchronously via message.
Initialize the LTC neuron and enter the main loop.
-spec reset_state(pid()) -> ok.
Reset the internal state of the LTC neuron to zero.
Useful when starting a new episode or sequence.
Start an LTC neuron process.
Options (in addition to standard neuron options): - neuron_type - ltc (ODE) or cfc (closed-form), default: cfc - time_constant - Base time constant tau, default: 1.0 - state_bound - State bound A, default: 1.0 - ltc_backbone_weights - Backbone network weights, default: [] - ltc_head_weights - Head network weights, default: [] - internal_state - Initial internal state, default: 0.0 - dt - Time step for ODE mode, default: 0.1