src | ||
tests | ||
.gitignore | ||
LICENSE | ||
README.md |
Discrete neural nets
This repository contains code and examples of implementing the notion of a discrete neural net and polymorphic learning in Python. For more information on these notions, see the corresponding preprint on the arXiv.
Project structure
The scripts that define basic components of the system are in the src
folder.
These are:
arithmetic_operations.py
: Definitions of arithmetic operations modulo some positive integer. These are used to test the basic functionality of theNeuralNet
class.dominion.py
: Tools for creating dominions, a combinatorial object used in the definition of the dominion polymorphisms inpolymorphisms.py
.dominion_setup.py
: Utilities for creating files of trees, dominions with those trees as constraint graphs, and the data for the corresponding polymorphisms.graphs.py
: Utilities for creating and storing simple graphs, including randomly-generated trees.mnist_training_binary.py
: Describes how to manufacture binary relations from the MNIST dataset which can be passed as arguments into the polymorphisms inpolymorphisms.py
.neural_net.py
: Definition of theNeuralNet
class, including feeding forward and learning.operations.py
: Definitions pertaining to theOperation
class, whose objects are to be thought of as operations in the sense of universal algebra/model theory.polymorphisms.py
: Definitions of polymorphisms of the Hamming graph, as well as a neighbor function for the learning algorithm implemented inneural_net.py
.random_neural_net.py
: Tools for makingNeuralNet
objects with randomly-chosen architectures and activation functions.relations.py
: Definitions pertaining to theRelation
class, whose objects are relations in the sense of model theory.
The scripts that run various tests and example applications of the system are
in the tests
folder. These are:
src.py
: This script allows horizontal imports from the siblingsrc
folder. (That is, it adds it to the systemPATH
variable.)test_binary_relation_polymorphisms
: Examples of the basic functionality for the polymorphisms defined inpolymorphisms.py
when applied to binary relations.test_dominion.py
: Examples of constructing and displaying dominions as defined indominion.py
.test_dominion_setup.py
: Create trees and dominions for use with dominion polymorphisms.test_graphs.py
: Examples of creating graphs (including random trees) as defined ingraphs.py
.test_mnist_training_binary.py
: Verification that MNIST training data is being loaded correctly from the training dataset.test_neural_net.py
: Examples of creatingNeuralNet
s using activation functions fromarithmetic_operations.py
and theRandomOperation
fromrandom_neural_net.py
.test_relations.py
: Examples of the basic functionality for theRelation
s defined inrelations.py
.
Environment
This project should run on any Python3 environment without configuration. It
assumes that there is a project folder which contains these subdirectories:
src
(for source code), tests
(for tests of basic functionality and
examples), and output
(for output json, image files, etc.). The output
folder is in the .gitignore
, so it should not be seen on cloning. It will be
created when a script that needs to use it is run.
TODO
- Reincorporate the polymorphisms for the higher-arity analogues of the Hamming graph which Lillian coded.
Thanks
Thanks to all the contributors to the original incarnation of this repository:
- Rachel Dennis
- Hussein Khalil
- Lillian Stolberg
- Kevin Xue
- Andrey Yao
Thanks also to the University of Rochester and the University of Colorado Boulder for supporting this project.