Copyright Brain Engineering Lab at Dartmouth. All rights reserved.
Please feel free to use this code for any non-commercial purpose under the CC Attribution-NonCommercial-ShareAlike license: https://creativecommons.org/licenses/by-nc-sa/4.0/
If you use this code, cite:
- Rodriguez A, Bowen EFW, Granger R (2022) https://github.com/DartmouthGrangerLab/hnet
- Bowen, EFW, Granger, R, Rodriguez, A (2023). A logical re-conception of neural networks: Hamiltonian bitwise part-whole architecture. Presented at AAAI EDGeS 2023. https://www.dropbox.com/s/fitxfi5br7251j2/AAAI_EDGeS%202023_paper.pdf?dl=1
Some CLEVR-like stimuli were generated via the code available at https://github.com/DartmouthGrangerLab/custom_clevr_stimgen
- "edge" - 2 bits per pixel pair (just a pair of pixel values, e.g. 1-1 = both pixels are white)
- "component" - a single set of edge states (can be represented by one composite Hamiltonian)
- "component bank" - a set of components, stored together, sharing a graph
- "model" - a hierarchy of component banks
types of components:
- "connected part" - a long string of edges, like a curve
- "group" - a set of connected part components
- "meta" - a second tier of components
- "meta group" - a group of meta components
- comp/cmp - component (see terminology)
- idx - index (into another array)
- h - hamiltonian
- trn - training data
- tst - testing data
common/
- lab common librariesfigurecode/
- functions that render results to filetrain/
- code required exclusively for trainingTrain()
- performs all training by calling other functions in thetrain/
folder
- data structures
ComponentBank
- stores one complete component bankDataset
- loads whichever dataset you request, in a storage container for easy useEDG
- edge state enumGRF
- graph type enumModel
- stores a set of component banks, and the connections amongst them
Encode()
- matches components against new datapoints (often callsEnergy()
)Energy()
- computes the energy of each datapoint using each composite HamiltonianMain()
- code entry point; loads the data, trains, tests, prints output / figures
Dependencies:
- matlab (designed for matlab version r2022a), python 3
- matlab toolboxes: Computer Vision Toolbox, Deep Learning Toolbox, Image Processing Toolbox, Statistics and Machine Learning Toolbox
Setup:
- Pull (or download) hnet from https://github.com/DartmouthGrangerLab/hnet
- Navigate matlab's working directory to ./hnet/matlab
- Add the hnet/matlab/* subfolders to your matlab path.
- to run: in matlab, execute one of the following:
Main("metacred", "ucicreditgerman", "tier1.memorize-->tier1.extractcorr.icacropsome.100.50.unsupsplit-->meta.extractcorr.kmeans.10.50.unsupsplit");
Main("groupedimg", "mnistpy.128", "connectedpart.memorize-->connectedpart.extractconnec.25-->connectedpart.transl.2");
Main("clevrpos1", "clevrpossimple", "tier1.memorize");