Skip to content

Neural Network Sim is a Python-based neural network simulation tool that uses the Pygame library to visualize the behavior of a network of 25 neurons. It's customizable, easy to use, and helpful for exploring neural networks.

Notifications You must be signed in to change notification settings

jainsid24/neural-network-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Network Simulation

License: MIT Commit Activity Repo Size Python Version Pygame Version Random Version Sys Version Code style: black

Contents

  1. About
  2. Dependencies
  3. Running the Code
  4. Simulation Parameters
  5. Code Structure
  6. Resources
  7. Code Documentation
  8. License
  9. Want to Contribute?

About

This code simulates a simple neural network using Pygame library. The network consists of 25 neurons (configurable), each with a probability of being activated. The connection strengths between the neurons are randomly initialized, and they can be strengthened or weakened based on the activation patterns.

Animated GIF

Dependencies

The following libraries are required to run this code:

  • Pygame
  • Random
  • Sys

Running the Code

To run the code, execute the following command in the terminal:

python neuron.py

This will start the Pygame window and run the simulation.

Simulation Parameters

The following parameters can be adjusted in the code to change the behavior of the simulation:

  • WINDOW_SIZE: The size of the game window.
  • NUM_NEURONS: The number of neurons in the network.
  • INITIAL_PROBABILITY: The probability of each neuron being activated.
  • MAX_CONNECTION_STRENGTH: The maximum value for the connection strengths.
  • MIN_CONNECTION_STRENGTH: The minimum value for the connection strengths.
  • CONNECTION_STRENGTH_DELTA: The value by which to increase or decrease the connection strength.
  • PROBABILITY_THRESHOLD: The threshold for updating the neuron probabilities.
  • PROBABILITY_INCREASE: The value by which to increase the neuron probabilities.
  • PROBABILITY_DECREASE: The value by which to decrease the neuron probabilities.

Code Structure

The code is structured into the following functions:

  • draw_background: Draws a background on the screen.
  • draw_sparks: Draws random sparks on the screen.
  • draw_connections: Draws the connections between the neurons on the screen.
  • update_probabilities: Updates the probabilities of the neurons based on the activation patterns.
  • mutate_connections: Mutates the connection strengths between the neurons.
  • apply_external_input: Applies external input to the neurons.
  • apply_feedback: Applies feedback to the neurons based on their activation patterns.
  • apply_inhibition: Applies inhibition to the neurons based on their activation patterns.
  • apply_synaptic_plasticity: Applies synaptic plasticity to the connections between the neurons.
  • apply_learning: Applies hebbian learning to the connections between the neurons.
  • apply_modulatory_signals: Applies modulatory signals to the neurons.
  • apply_homeostasis: Applies homeostasis to the neurons.
  • apply_refractory_period: Applies a refractory period to the neurons.
  • apply_noise: Applies noise to the neurons.
  • draw_activation_effect: Draws the activation effect on the screen.

The main function contains the main loop of the game, which handles events, clears the screen, draws the connections, updates the network, and updates the screen.

Documentation

Resources

License

This code is licensed under the MIT License.

Want to Contribute?

Check out CONTRIBUTING.md.

About

Neural Network Sim is a Python-based neural network simulation tool that uses the Pygame library to visualize the behavior of a network of 25 neurons. It's customizable, easy to use, and helpful for exploring neural networks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages