neuron_info (macula_tweann v0.18.1)

View Source

Neuron Introspection API.

This module provides introspection capabilities for neurons in macula-tweann. It can extract information from both neuron records and running neuron processes.

Usage

From a neuron record:

Info = neuron_info:get_neuron_info(NeuronRecord), #{neuron_type := Type, time_constant := Tau} = Info.

From a running neuron process:

Info = neuron_info:get_neuron_info(NeuronPid), #{neuron_type := cfc, internal_state := State} = Info.

Returned Information

The returned map contains:

neuron_type - standard | ltc | cfc time_constant - tau value (for LTC/CfC neurons) state_bound - A value (for LTC/CfC neurons) internal_state - current x(t) state (for LTC/CfC neurons) activation_function - the activation function atom plasticity_function - the plasticity function (if any) input_count - number of input connections output_count - number of output connections capabilities - list of neuron capabilities

Summary

Functions

Get a human-readable description of a neuron type.

Get capabilities for a neuron type.

Get comprehensive information about a neuron.

Get just the neuron type.

Check if a neuron type has temporal memory.

Types

neuron_info/0

-type neuron_info() ::
          #{neuron_type := standard | ltc | cfc,
            time_constant := float(),
            state_bound := float(),
            internal_state := float(),
            activation_function := atom(),
            plasticity_function := atom() | undefined,
            input_count := non_neg_integer(),
            output_count := non_neg_integer(),
            capabilities := [atom()]}.

Functions

describe(NeuronType)

-spec describe(NeuronType) -> binary() when NeuronType :: standard | ltc | cfc | atom().

Get a human-readable description of a neuron type.

get_capabilities(NeuronType)

-spec get_capabilities(NeuronType) -> [atom()] when NeuronType :: standard | ltc | cfc | atom().

Get capabilities for a neuron type.

Returns a list of atoms describing what the neuron type can do:

temporal_memory - Can remember past inputs adaptive_dynamics - Time constant varies with input fast_inference - Optimized for production speed ode_accurate - Uses accurate ODE integration hebbian_plasticity - Supports Hebbian learning modulated_plasticity - Supports neuromodulation

get_neuron_info(Neuron)

-spec get_neuron_info(Neuron) -> neuron_info()
                         when
                             Neuron ::
                                 #neuron{id :: term(),
                                         generation :: term(),
                                         cx_id :: term(),
                                         pre_processor :: term(),
                                         signal_integrator :: term(),
                                         af :: term(),
                                         post_processor :: term(),
                                         pf :: term(),
                                         aggr_f :: term(),
                                         input_idps :: term(),
                                         input_idps_modulation :: term(),
                                         output_ids :: term(),
                                         ro_ids :: term(),
                                         neuron_type :: term(),
                                         time_constant :: term(),
                                         state_bound :: term(),
                                         ltc_backbone_weights :: term(),
                                         ltc_head_weights :: term(),
                                         internal_state :: term(),
                                         innovation :: term()} |
                                 pid().

Get comprehensive information about a neuron.

Accepts either a neuron record or a running neuron process pid. Returns a map with all available neuron information.

get_neuron_type(Neuron)

-spec get_neuron_type(Neuron) -> standard | ltc | cfc | unknown
                         when
                             Neuron ::
                                 #neuron{id :: term(),
                                         generation :: term(),
                                         cx_id :: term(),
                                         pre_processor :: term(),
                                         signal_integrator :: term(),
                                         af :: term(),
                                         post_processor :: term(),
                                         pf :: term(),
                                         aggr_f :: term(),
                                         input_idps :: term(),
                                         input_idps_modulation :: term(),
                                         output_ids :: term(),
                                         ro_ids :: term(),
                                         neuron_type :: term(),
                                         time_constant :: term(),
                                         state_bound :: term(),
                                         ltc_backbone_weights :: term(),
                                         ltc_head_weights :: term(),
                                         internal_state :: term(),
                                         innovation :: term()} |
                                 pid() |
                                 neuron_info().

Get just the neuron type.

is_temporal(Neuron)

-spec is_temporal(Neuron) -> boolean()
                     when
                         Neuron ::
                             #neuron{id :: term(),
                                     generation :: term(),
                                     cx_id :: term(),
                                     pre_processor :: term(),
                                     signal_integrator :: term(),
                                     af :: term(),
                                     post_processor :: term(),
                                     pf :: term(),
                                     aggr_f :: term(),
                                     input_idps :: term(),
                                     input_idps_modulation :: term(),
                                     output_ids :: term(),
                                     ro_ids :: term(),
                                     neuron_type :: term(),
                                     time_constant :: term(),
                                     state_bound :: term(),
                                     ltc_backbone_weights :: term(),
                                     ltc_head_weights :: term(),
                                     internal_state :: term(),
                                     innovation :: term()} |
                             standard | ltc | cfc |
                             neuron_info().

Check if a neuron type has temporal memory.