Code Monkey home page Code Monkey logo

emergence's Introduction

Welcome to Emergence

This is a research library to study the emergent properties of undirected neural networks, including Hopfield networks and Boltzmann machines.

Contributors: Sonia Joseph, Andreanne Lemay (andreanne-lemay)

To read more about Hopfield networks, see the primer I wrote here.

Setup

Set up your local environment and install package.

python3 -m venv env
pip3 install -e .

See /tests for sample use cases.

Hopfield Networks

Hopfield networks are fascinating one-shot data-denoisers. We train the network to "remember" the top row of fashion MNIST images using Hebbian learning. The network does not store the actual image, but encodes information of the image in its weights.

Then, we add noise to the image, randomly setting 30% of the pixels to the opposite value. When we feed each random image into the pre-trained Hopfield network, we get the original image back (bottom row)!

Example on FMNIST

Original
Noisy
Reconstructed

Use

from emergence.hopfield import Hopfield
from emergence.preprocess.preprocess_image import * 

# Preprocess data
fashion_mnist = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
row, col = train_images[0].shape
data = train_images[5:9]
data = [normalize_binarize(i) for i in data]
data = [i.flatten() for i in data]

# Train network
hn = Hopfield()
hn.train(data)

# Get noisy data
noise_data = [noise_image(i, .3) for i in data]

# Run network on noisy data
data_hat = [hn.run(i, 1) for i in noise_data]

Run above file

python -m emergence.tests.hopfield_fmnist

See /tests for more examples.

Resources

Hopfield Networks - A Primer

Neural networks and physical systems with emergent collective computational abilities

emergence's People

Contributors

andreanne-lemay avatar soniajoseph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

zuxfoucault

emergence's Issues

Create a Boltzmann Machine Object

Boltzmann machines are similar to Hopfield networks, except they are stochastic. Create a Boltzmann machine object with the same functionality as the Hopfield network object, mimicking its structure with the appropriate, Boltzmann-specific changes.

Hi

Hi I am interested in this work and would like to know more during the HBM Brainhack!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.