Basic Structure
Basic components
Assembly
is the most important basic class in SPAIC . spaic.Assembly
contains three part: Network
,NeuronGroup
and Node
. spaic.Network
is the basic class of the whole model. spaic.NeuronGroup
contains neurons. spaic.Node
is the basic class of the input and output nodes.
Front-end structure:
Assembly
Assembly
is an abstract class of neural network structure, representing any network structure, and other network modules are subclasses of the Assembly
. Assembly
has two properties named _groups
and_connections
that save the neurons and connections. As the main interface for network model, it contains the following main functions:
add_assembly(name, assembly) – Add new assembly members into the neuron assembly
del_assembly(assembly=None, name=None) – Delete exist members from the neuron assembly
copy_assembly(name, assembly) – copy an exist assembly and add it into this assemlby
replace_assembly(old_assembly, new_assembly) – replace an exist member with a new assembly
merge_assembly(assembly) – merge the given assembly into another assembly
select_assembly(assemblies, name=None) – choose part of the target assembly as a new assembly
add_connection(name, connection) – add a new connection into the assembly
del_connection(connection=None, name=None) – delete the target connection
assembly_hide() – hide this assembly
assembly_show() – show this assembly
NeuronGroup
spaic.NeuronGroup
is the class with some neurons, usually, we call it a layer of neuron with same neuron model and connection ways. For more details, please look up Neuron
Node
spaic.Node
is the transform node of model, it contains a lot of encoding and decoding methods. Encoder
, Decoder
, Generator
, Action
and Reward
are all inherited from Node
. For more details, please look up Encoder & Decoder
Network
spaic.Network
is the most top structure in SPAIC , all modules like NeuronGroup
or Connection
should be contained in it. spaic.Network
also controls the training, simulation and some data interaction process. spaic.Network
supports some useful interface as follow:
run(run_time) – run the model, run_time is the time window
save_state – save the weight of model
state_from_dict – load weight of model
Projection
spaic.Projection
is a high-level abstract class of topology, instead of Connection
, Project
represent the connections between Assembly
s. Connection
is subclass of Projection
, when user build Projection
between Assembly
s, the construct function will build the corresponding connections according to the policies
of Projection
Connection
spaic.Connection
is used to build connections between NeuronGroup
s, it also used to construct different synapses. For more details, please look up Connection
Backend
The core of backend that construct variables and generate computational graph. For more details, please look up Backend 。