Skip to content

synth-me/HopfieldNetwork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HopfieldNetwork

Setup

Requirements
ghc ( if you want to build the API yourself )
raku 
zef 
all you need to do is run the file :
git clone [this repo]
setup.bat 
or manually
zef install JSON::Tiny
zef install Terminal::ANSIColor
ghc main.hs 

Last Updates :

  • Implementation of native Haskell API to process the binary vectors and transformations
  • if you do not want to compile the API download the exe here : My drive!

Some theory :

The theory behind Hopfield Networks can be found here :

EDX free course about computational neuroscience !

The ideia :

The goal of Hopfield models is to a mathematical model to associative memory especially for images

Here I could implement a first of this model, but there's still a long path towards a totally useful model

Start :

Images can be binary multidimensional arrays like this example :

(Illustrative example)

Here we create a hash from multidimensional arrays that are our images from the /images folder
my $trainingset = ImageSet.new(
    myimages=>{
        "image0"=>"image0.json",
        "image1"=>"image1.json"
    }
);
my $testingset = ImageSet.new(
    myimages=>{
        "image2"=>"image2.json"
    }
);
# this is the info that will populate our training information 
my $mytrainingsetfinal = $trainingset.genSet(8); 
# this will be the ones used to test the net 
my $mytestingsetfinal = $testingset.genSet(8);
To create a new net :
my $model = HopfieldNetwork.new(
    dataset=>$mytrainingsetfinal,
    testset=>$mytestingsetfinal,
    title=>"mynet"
); # here we use our generated formatted data to feed the net 
To run a prediction :
$model.predict # store the result 
$model.showResult # show the similarities 
To save your current model :
$model.export # this goes as mymodel.json
To load a new model :
$mode.loadModel("mynet") # here goes the name of the json exported from model

Future goals :

  • Implementation of zef or panda module
  • Implementation of higher features from Hopfield Models and variations

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published