Skip to main content

Neural Probabilistic Programs (NeuralPPs)

Project description

Neural Probabilistic Programs (NeuralPPs)

This is an implementation of graphical models inference (Variable Elimination) using PyTorch for implementing factors (conditional probabilities and priors). Those can be implemented as tables (the typical discrete graphical model implementation) but also as arbitrary PyTorch modules, the case of most interest being of course neural networks.

The reason we are calling it "probabilistic programs" even though we only have discrete graphical models so far is that factors and variables are implemented in a manner general enough for probabilistic programming symbolic implementations be introduced down the road.

Purpose

This project is for researchers interested in exploring the connection between probabilistic and neural network inference. It is a library that provides the utilities for mixing neural networks and graphical models while offering GPU use and stochastic gradient descent training.

Content

This repository contains:

  • source code, including an experiments directory
  • test code (to be run with PyTest)
  • setup.py for installing with Pip
  • environment.yml for importing a Conda environment

Installation

First, clone the repo locally:

git clone https://github.com/rodrigodesalvobraz/neuralpp.git
cd neuralpp

Then, to install a developer copy, run:

python setup.py develop

Alternatively, for a regular installation:

python setup.py install

Experiments

In src/experiments one can find src/experiments/simple_mnist.py, which shows how to use a "graphical model" with a single factor, implemented by a convolutional neural network, to learn how to recognize MNIST digits.

In src/experiments/mnist_pairs_semi_supervised.py there is code attempting to train a MNIST recognizer from pairs of images of successive digits only. It does not yet work but the script offers many options for running simplified versions of the problem, many of which do work.

Tests

Tests in neuralpp.test are split into quick_tests and slow_tests. The former include tests of basic data structure implementations while the latter includes learning sessions with stochastic gradient descent and take several minutes.

Run them with pytest . from the root directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuralpp-0.1.0.tar.gz (72.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuralpp-0.1.0-py3-none-any.whl (108.8 kB view details)

Uploaded Python 3

File details

Details for the file neuralpp-0.1.0.tar.gz.

File metadata

  • Download URL: neuralpp-0.1.0.tar.gz
  • Upload date:
  • Size: 72.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for neuralpp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2ca58c2ea1cdcdfce89a1476d3f25bbdfa20cd06672d3e499df35e773c92c6d1
MD5 d46872e7d1f7d2c115e71df3aba9e75c
BLAKE2b-256 577bf7cef3ce9fc8996b95148d0ec4985433d909b805f4ddc354ccdbfac3954b

See more details on using hashes here.

File details

Details for the file neuralpp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: neuralpp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 108.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for neuralpp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d36207e3db87d6c201ca6d7298edff33de8382fa31d31751802051b7f78d3fd7
MD5 81108c701f3164fb8182a7f10df4192a
BLAKE2b-256 4a598badd76ac0923afcd031172378ab7eab246fdc5fe0214cc91aac57e0dae1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page