(Magyar)


Neural Network Experiments by M4XY5T


I recently started some research on Neural Topologies, Neural Network Simulation, Learning and Evolutional Algorithms. What came out is a program (work in progress) which will eventually be able to 'design' a neural network topology from scratch evolutionally, which must be much more economical for implementation than the typical layered ANN where all neurons in a layer are uniformly connected to the neurons of the adjacent layer.
This will be similar to NEAT , NeatJS algorithms. My program will essentially be a much simpler fast problem-specific solution written in C. What these algorithms basically do is starting with bare inputs and outputs and mutating by adding new synapses and/or neurons stochastically/deterministically at every new generation. Each generation has a 'champion' who won the highest 'fitness' point in an environmental simulation, and these champions are used as parents for the next generation. (If I manage to make a proper physical simulation engine in my program, I might start the first generation with literally nothing, not even inputs and outputs defined, and rely on the software even for the addition of new input sensors and output muscles...) Beside topological evolution, synapse-weights of the entities are also trained either by unsupervised Hebbian learning or supervised back-propagation teaching when a new topology arises.
There will be more kinds of selectable neural network simulations and learning types in my program, mostly targeted for hardware realization, for example with restrictions of running it in an MCU, or maybe as an analog neural circuit built from transistors as neural nodes. (I think it's possible, transistor with resistors as 'weights' on its base seems to be a good candidate with its nonlinearities as neuron for low-complexity neural circuits). The use cases for such hardware-based neural networks are many, from shape recognition to even a full robot with motion coordination.
The program is solely based on C standard library and SDL library for graphics and controls. Currently it is able to receive an arbitrary synaptic list (currently only in source-code before compilation), to process it (remove redundances, check for feedbacks and gap-junctions, topological sort, layerizing, etc.), to find and display the inputs, outputs and neurons and their connections. Some manipulations are also already possible, like setting inputs manually as stimuli for the simulation, and to display only selected neurons or paths to make it easier to dissect and analyze the network.

As we're talking about topology of neurons, to test the above mentioned display capabilities of my program, I selected the connectome of the only creature (to date) with completely known connectome, the Caenorhabditis Elegans worm. It has cca 300 neurons and around 4000 connections, which can be chemical excitatory (e.g. glutamate) and inhibitory (e.g. GABA), or weak electrical (bi-directional cell gap-junctions). From simulation point of view they can be handled the same way, they're treated as weighted inputs of neurons. What complicates the simulation a bit is that despite the topological dependency sorting what the program makes, this connectome designed by nature is still very recurrent, there are a lot of feedbacks from neurons of higher (closer-to-output) layers to neurons at lower (closer-to-input) layers. Gap-junctions are partly kindof mutual feedbacks as well. Fortunately autapses (self-feedback neurons) seem to be absent in C. Elegans.

Both compiled Linux and Windows versions of the program are available here in the zip file . The SDL-1.2 library is required to run them, so I included SDL.dll in the zipped folder for the Windows version, just in case. The source code is not yet polished, so despite my opensource-mindedness I won't share it just yet on the webpage to avoid critiques that usually ensue when people look at crowded C code. If you want to have a look at it you can contact me at and we can discuss it... (I took the connectome data and some ideas from this interesting basic simulation: Celegans-simulation)

Different colours are used for the forward-synapses (shades of green or red based on their weights and polarity) and the feedbacks (shades of blue/purple) and gap-junctions (greyish). The inputs, neurons and output-wires get shades of green/red depending on their current outputs.
The short help with the usable keys can be seen at the top of the screen. Pressing SPACE highlights synapses of selected neurons, pressing ENTER calls the path-highlighting mode where dependency tree traversal can follow all of the connecting synapses from input (if I is pressed) or backwards from output (if O is pressed) or paths between inputs and outputs (by pressing key 'P'). The complexity of the selected synapses changes drastically if the feedbacks are displayed (toggle by F key), and changes somewhat when gap-junctions are toggled with G key.
Navigation with cursor keys and pressing Insert/Delete alters the selection of nodes (neurons or inputs/outputs) whose paths get highlighted. Holding down SHIFT in neuron-selector mode can be used to select synapses with cursor-keys for emphasizing (widening) by Insert key. By pressing key 'S' the selections of neurons, inputs, outputs and widened synapses are saved into a file named 'selections.sel' in the executable's folder. These files can be renamed and used as an argument after 'Celegans' executable in command line to reload them. I made some examples of .sel files (used for the screenshots), they can be found in the zipped program-package.
Manipulation of input signals (with keys 0..9, F1..F9) will end the initial equillibrium by introducing noise to the system and the simulation comes to life. From that moment the feedbacks keep the network breathing even if the input stimulus disappears. In the program's current version the 'firing' neural network simulation is implemented and hardwired at the moment, which mimics the burst-like physiological signalling of the neuron membranes called 'Action Potential'. More sophisticated versions of the simulation with physical environment and worm-body simulation and display will come later.

While the connectome of the C. Elegans is known it is still the topic of an extensive scientific research, what sub-circuits / modules are responsible for the different behaviours of this animal. With physical tests scientists could separate neurons of certain functions in the worm, yet some other neurons are not well understood. Parts of the topology have been reverse-engineered though, for example we know (and see in my program) that there is an encoder-decorer-like hourglass topology where the hidden interneural layers are narrower than the input-output layers. The inputs are processed/encoded very early in the lower layers into information of smaller/simpler dimensions. There are many exceptions of course where input-neurons are connected to higher layers too, probably to get faster responses to survival-threatening inputs (e.g. retreats from obstacles).
The so-called 'rich-club' neurons of the network can also easily be identified in the higher layers near to the output. These neurons have many synapses that reach out far to other neurons at more distant layers. Examples are neurons called AVAL,AVAR, according to the C. Elegans notation scheme. The power-law appears to be a general rule in neural networks: the majority of neurons connect only to their neighbours and other local neurons, while only a small percentage of the neurons formulate numerous costly but handy far-reaching connections. These rich-club neurons are among the first to appear during embryonal development, which seems logical, as this way their long connections can grow together with the developing nervous system.
The other thing that is clearly seen in my program is that the output motor-neurons controlling the muscles (e.g. MDL20) have input dendrites from both excitatory (green) and inhibitory (red) origins so they're controlled in a differential/complementary way by opposing neurons. These motoric functions are quite well described in these documents: A circuit for navigation in C. Elegans , Locomotion of C. Elegans
The behavioral and social aspects of the C Elegans are also well studied. These are some valuable documents on the topic: Neuronal microcircuits for decision making in C Elegans , Hub-and-spoke Pheromone and Social behaviour in C Elegans
(Neuropeptides which modulate the workings of neurons also play a big role in the animal's behaviour so a strict synaptical simulation may not be enough to properly simulate the worm's surprisingly complex adaptational abilities. The OpenWorm project targets true cell-based simulation which might solve this problem too.)
There are some other good reads in PDF form on scientific research sites about different aspects of the relation between the connectome topology and behaviour, chemical and electrical signals, etc... Beside this, I hope this program also aids some people in the investigation of the C. Elegans's neurology, and brings us closer to the understanding of Nature's ways of wiring neurons together, even in more complex brains like ours.
As soon the program evolves (sorry for the unintended pun) I'll update this page with the fresh results... But for now let's see some screenshots of my findings thanks to the program's synapse-selection and highlighting methods:

The full C. Elegans hourglass-like connectome as shown in my program. Hard to decipher by the eye, too many connections...



Excerpt from the above linked PDF discussing Microcircuits for Decision Making
I will try to follow and understand these paths from inputs to outputs with the help of my program.



Excerpt from the above linked PDF discussing Locomotion
This is the final stage of the motion-control (pre-motor and motor-neurons).



Coming below are the screenshots of involved neurons and inputs/outputs of the phases which the PDF article about Decision Making mentions. These pictures might give an overall view about the locations of the neurons and the dependencies of the different layers/stages on each other. Later the individual input-to-output paths will be dissected and highlighted/emphasized so we can dive deeper into more specific details... But first we need to know what parts of the connectome are important for an examination before going on by eliminating the unrelated ones.
Tip: The screenshots below are not the best form of viewing the connectome as they don't move. In the program I move the nodes by a Lisajjous-curve so accidentally overlapping lines are not permanent and the human eye can grab more details. So I advise to use the '.sel' files as a commandline argument for the program to invoke these selections seen on the screenshot and examine the connectome in the program instead. The selections can be modified/simplified there as well...

1st stage, the connections (including feedbacks and gap-junctions) of selected and highlighted sensor neurons of C. Elegans
From first to last picture: Mechanoreceptors/Pressure-sensors, Oxygen and CO2 sensors, Temperature sensors, Odor sensors



The input-paths (excluding feedbacks) from the above mentioned sensors (in the same order) to all affected outputs
Individual connections are still hard to follow on these pictures, but they can give a hint about affected outputs.



2nd stage, The nerve-ring Hub-neurons, Run and Turn interneurons that process the input sensor signals directly or indirectly.
From first to last picture: Hub-neurons, 'Run' sensory interneurons, 'Turn' sensory interneurons



3rd stage, The pre-motor command interneurons (AVB:forward, AVA:backward) which control the last stage of excitatory/inhibitory motor-neurons
PVC,RIM and DVA are mostly presynaptic to the rest. Most of the command neurons are also part of the rich-club.



4th stage, The excitatory/inhibitory motor-neurons that drive the muscles throurgh the neuromotor-junctions (names starting with 'M')
As it is clearly seen, the GABAergic inhibitory (red) outputs from DD and VD neurons counteract effects of DA,DB,VA,VB.



Last stage: Some examples of all input-to-output paths (excluding feedbacks) to some neuromotor-junctions
From first to last: MDL16 left-dorsal, MVL14 left-ventral, MR09 right-dorsal, MVR12 right-ventral motors, and finally some PVCL/MVR/MVL/etc. manually widened connections (with SHIFT-key held down plus CURSOR/Insert keys)




That's it for now. As soon I'll have the time for more investigation I'll refresh this page with the new screenshots and explanations which will mostly cover the individual emphasized (highlighted and widened) paths of run/turn, forward/backward and other behaviours of the worm. If anyone tries this program and finds some interesting aspects of the connectome, I encourage you to share the information with me (to include in the page) or others through the forum comments...

2020 M4XY5T ,