Neuron Simulator Documentation

This is a crude simulation of neurons. The objective is to refine it until I get something that more plausibly reflects reality -and perhaps even results in some sort of limited thought or learning.

The background displays the local activation in any given area. When a neuron fires, it deposits positive (or potentially negative) activation near the synapse points on the canvas. The background is constantly smoothed so that the activation values are spread out. This allows the values to fade, and it also creates a gradient that dendrites can detect and follow to be able to seek out new connections.

Dendrites seek out areas of higher activation values. There are currently only four for each neuron, but there is room for addition of more.

Axons are not currently drawn, but you can see where they are when the neuron fires; you'll see faint dots appear and fade.'Like the dendrites, there are 4 axons and it could be possible to add more and not have to re-code the while project. Currently, axons do not seek out dendrites.

Neurons are currently randomly created and placed on the canvas. The body of each neuron is represented with a colored dot. I have experimented a little with neuron mobility, however, the issue right now is that the neuron's own synapses guide it away from it's own activations when it fires. The leads to all the neurons moving mostly in one direction. Each neuron has an internal clock that prevents it from firing for a short period after firing. This helps prevent neurons from connecting to themselves in infinite activation loops.

What's left to do: So far the framework is in place to do what I think needs done. However, the specific conditions to trigger the various responses need to be identified and coded. One way to identify the right conditions is to ask the right questions. Here are a few questions to start out:

Interactivity: I do plan to add some controls so that people can play around with it and do their own experiments. Then I hope to get feedback, which will help me improve it.

Flow Graph Overview

  1. Initialization Process

    • Start
      • Load Page
      • Call restart function
        • Set nueronCount and clock values from user input.
        • Initialize canvas and context (ctx).
        • Create an empty list nodes to store neurons.
        • Randomly Generate Neurons
          • Loop to create neurons using makeNeuron at random positions.
        • Setup Event Listeners
          • Enable users to add new neurons by clicking on the canvas.
        • Start Timers
          • Use setInterval to regularly call go (main update loop) and dataIn (periodic input of data).
  2. Neuron Creation (makeNeuron)

    • Input ➔ Coordinates (x, y) where neuron is to be placed.
    • Define Axons and Dendrites
      • Create arrays representing axon and dendrite positions relative to the neuron.
      • Set Initial Valuesval = 0
    • Output ➔ Return a neuron object { val, ax, dn, x, y }.
  3. Periodic Data Input (dataIn function)

    • Check Flip-Flop State ➔ Determines data pattern (alternating input pattern).
    • Draw Activation Blobs
      • Use drawBlob to input activation values at specific points on the intensity map.
    • Flip State ➔ Switch flipflop state for the next cycle.
  4. Main Update Loop (go function)

    • Call drawPotential
      • Update neuron positions based on their environment.
      • Calculate and adjust neuron activation based on input from axons and dendrites.
      • Move neurons based on gradients using functions like moveBy.
    • Apply Visual Effects
      • Blur ➔ Call blur to smooth the intensity map.
      • Render ➔ Draw neurons and activation gradients onto the canvas.
  5. Neuron Activation and Movement (drawPotential function)

    • Loop Through All Neurons (nodes)
      • Assess Neuron Position
        • Move Neurons ➔ Adjust position based on space values using sign, moveBy, and gradient functions.
      • Calculate Activation (getWeights)
        • Check Threshold ➔ If activation exceeds threshold, neuron "fires":
          • Send signals through axons (set activation values).
          • Reset neuron value.
          • Reduce activation around the neuron with decreaseBy.
      • Adjust Axons and Dendrites
        • Axons ➔ Move towards lower activation areas using goToLower.
        • Dendrites ➔ Move towards higher activation areas using goToHigher.
      • Clean Activation Around Neurons
        • Call cleanArea ➔ Reset local activation to default values.
  6. Canvas Rendering (render function)

    • Draw Activation Gradient
      • Generate ImageData ➔ Use activationGradiant to translate intensity values into color gradients.
      • Draw Neurons
        • Loop Through nodes ➔ Draw connections (axons, dendrites) and neuron bodies using color codes to indicate active or resting states.
  7. Adjust Environment Interaction (utility.js)

    • Helper Functions
      • put, drawBlob, decreaseBy ➔ Manipulate activation values in the intensityMap.
      • Gradient Functions ➔ Move to higher or lower activation areas using sign, goToHigher, goToLower.
    • Intensity Manipulation
      • Blur (blur function) ➔ Smooth activation values to simulate diffusion.
      • Control Activation Spread ➔ Functions to adjust local gradients around neurons.

Dall-E's attempt to draw flow chart of code

* Not very good at spelling.

What might be missing?


* The following is only AI's opinion. Some details are bassed on the way Artificaial neural networks function, so, may not be applicable. Other details may already be implemented in an indirect way. The AI may not have noticed the implications of my methods.

1. Complex Synaptic Connections

2. Refractory Periods and Spike Timing

3. Neurotransmitter Release and Diffusion

4. Membrane Potential Dynamics

5. More Sophisticated Dendritic Processing

6. Neuron Types and Differentiation

7. Learning Mechanisms and Feedback Loops

8. Temporal Dynamics

9. Energy Constraints and Metabolism

10. Noise and Stochasticity