hmcalister / Hopfield-Network-Go

An implementation of the Hopfield Network in Golang.
MIT License
2 stars 0 forks source link
go golang hopfield-network hopfield-neural-network linear-algebra

Hopfield Network Go

Author: Hayden McAlister

Badge for the Go build+test workflow

Running the Project

First, compile the project (to avoid potential slow downs from using go run):

Then, run the resulting binary:

Note that much of the functionality of the network is determined by command line arguments given at run time. Use ./hopfield -h to see a list of these.

Data on the run is saved to the directory specified (default: data/trialdata), which consists of a collection of parquet files pertaining to different sections of the hopfield networks behavior. See the section on Data Files

Data Files

networkSummary.pq

Defines data on the network. Independent of epochs, target states, probes, etc...

Effectively meta data on the trial.

Fields

learnStateData.pq

Collects data on the learning behavior of the network. In particular, measures properties of target states during the epochs of learning. Measured for every target state, for every epoch of training.

Fields

targetStateProbe.pq

Collects data on the target states after training. Measured after the network has trained in full.

Fields

relaxationResult.pq

Collects data on the results of relaxing probe states. Note this only involves the results and does not collect data on any intermediate steps. See RelaxationHistory.pq for this.

Fields

uniqueStates.pq

Like relaxationResult.pq, but only observes strictly unique states.

Fields

relaxationHistory.pq

Collects data on the relaxing probe states during relaxation. This involves a lot of data!

Fields

matrix.bin

A binary representation of the weight matrix after training.

targetStates.bin

A binary file consisting of a matrix. Each row in this matrix is a different target state for this trial.

Introduction

This project is an investigation into implementing the Hopfield network (and some other supporting methods) in Go using gonum as a linear algebra backend. This project is intended to be clean and extensible, as well as blazing fast and scalable with CPU cores via threading.

In future it may be interesting to try and port this project to use a different backend project - one that leverages linear algebra on CUDA to scale instead with the GPU.

Why Go?

Go was chosen for this project for the following reasons: