Skip to content

LLapsus/hopfield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hopfield Neural Network

Overview

This repository demonstrates the implementation of a Hopfield Neural Network. It includes code for creating, training, and testing the network, along with a Jupyter Notebook that explains the basic concepts and demonstrates the functionality of the network step by step.

Hopfield networks are a type of recurrent neural network that serve as content-addressable memory systems with binary threshold nodes. They are often used for pattern recognition and optimization tasks.

Features

  • Jupyter Notebook: A step-by-step tutorial explaining Hopfield networks and demonstrating the code functionality.
  • Code Implementation: A Python implementation of the Hopfield network.
  • Examples: Use cases showcasing pattern recognition and memory retrieval.
  • Insights into Hopfield Networks: Print weights, follow Hopfield network dynamics, and calculate energy for deeper understanding.

Files

  • hopfield.py: The main Python script containing utility functions and the primary class HopfieldNetwork.
  • hopfield_network.ipynb: A Jupyter Notebook that explains the basic theory and demonstrates the usage of the Hopfield network.

Prerequisites

To use this repository, you need Python 3.7 or higher and the following Python packages:

  • numpy
  • matplotlib (for visualizations in the notebook)
  • seaborn (for advanced visualizations in the notebook)
  • csv (for data handling in examples or input files)

Install the required dependencies using:

pip install numpy matplotlib seaborn

Getting Started

  1. Clone the repository:
git clone https://github.com/LLapsus/hopfield.git
cd hopfield
  1. Open the Jupyter Notebook:
jupyter notebook hopfield_network.ipynb
  1. Run the notebook cells to explore the implementation and functionality.

Usage

The Hopfield network can be used for:

  • Storing and retrieving binary patterns.
  • Demonstrating associative memory.

The hopfield_network.ipynb notebook provides detailed examples to get you started.

Theory

Hopfield networks are inspired by the human brain's associative memory system. They use an energy minimization principle to converge to a stored pattern. For more details, refer to the Jupyter Notebook, which explains:

  • The basic structure of a Hopfield network.
  • The learning rule (Hebbian learning).
  • How the network retrieves stored patterns.

Contributing

Contributions are welcome! If you find a bug or have an idea for improvement, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Special thanks to the creators of the Python libraries used in this project and the broader community for resources on Hopfield networks.

About

Simple implementation of Hopfield Neural Network

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors