brain_sup (macula_tweann v0.18.1)

View Source

Supervisor for brain system components.

This supervisor manages the inference and learning processes that together form a brain system. The supervision strategy is one_for_all because learning depends on inference state.

Architecture

brain_sup (one_for_all) | +-- brain (inference GenServer) | Forward propagation | Visualization data | Network state management | Publishes: evaluated | +-- brain_learner (learning GenServer) [optional] Plasticity rule application Experience buffer Weight updates Subscribes to: evaluated, reward_received Publishes: weights_updated

Communication

Subsystems communicate via brain_pubsub (built on OTP pg): - brain publishes evaluated after each forward pass - brain_learner subscribes to receive activations - brain_learner publishes weights_updated after learning - brain subscribes to update its network weights

Future Expansion

This supervisor is designed to accommodate future brain subsystems: - brain_memory: Episodic memory storage - brain_attention: Focus and salience control - brain_prediction: Forward model / world model

Summary

Functions

Get the PID of the inference process.

Get the PID of the learner process.

Start an unnamed brain supervisor.

Start a named brain supervisor.

Functions

get_inference_pid(SupPid)

-spec get_inference_pid(pid()) -> pid() | undefined.

Get the PID of the inference process.

get_learner_pid(SupPid)

-spec get_learner_pid(pid()) -> pid() | undefined.

Get the PID of the learner process.

init(Opts)

start_link(Opts)

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

Start an unnamed brain supervisor.

Options: - network - The neural network (required) - learning_enabled - Start learner process (default: false) - plasticity_rule - Rule for learning (default: modulated) - learning_rate - Learning rate (default: 0.01) - input_labels - Labels for visualization - viz_enabled - Enable visualization (default: true)

start_link(Name, Opts)

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

Start a named brain supervisor.