GithubHelp home page GithubHelp logo

lingxuez / rbm_ae Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 5.0 4.53 MB

My python implementation of RBM and denoising Autoencoder for pre-training

Python 100.00%
deep-learning autoencoder rbm python

rbm_ae's Introduction

RBM, Autoencoder, Denoising Autoencoder and pretraining

This is for Assignment 2 of CMU 10-807 "Topics in Deep Learning" from Lingxue Zhu.

Data

The MNIST dataset is stored under directory data/, downloaded from the course website.

RBM

To train an RBM with a given dimension of hidden layer dim_hidden and number of steps for contrastive divergence k_CD, run

python trainRBM.py <dim_hidden> <k_CD>

The output will be written to RBMresults/, including the learned weights and bias terms. As an example, the current directory contains the output from the following command

python trainRBM.py 100 1

To generate new images using a Gibbs chain starting from random configuration of the visible variables, run

python sampleRBM.py

The default setting generates 100 new images using the Gibbs sampler with 1000 steps.

(Denoising) Autoencoder

To train a (denoising) autoencoder with a given dimension of hidden layer dim_hidden and probability of adding noise noise_probability, run

python trainAutoencoder.py <dim_hidden> <noise_probability>

When noise_probability is set to 0, no noise is introduced and a regular autoencoder is learned. The output will be written to Autoresults/, including the learned weights and bias terms. As an example, the current directory contains the output from the following command

python trainAutoencoder.py 100 0.25

Pretraining a Neural Network

To fine-tune an one-layer neural network to classify the 10 handwritten digits with unsupervised pretraining, run

python trainNN.py <dim_hidden> <method>

where method defines the pretraining method, being one of

  1. RBM, using the results from RBM, the default is with k_CD=1.
  2. Auto, using the results from autoencoder without adding noise.
  3. DenoAuto, using the results from denoising autoencoder, the default is to use noise_probability=0.25.
  4. Random, randomly initialize the weights without pretraining.

Note that the pre-trained weights must be under directory RBMresults/ or Autoresults/ when using the corresponding method(s). The current directory contains the pre-trained weights for 100 dimension of hidden layer, and is ready to run the following commands:

python trainNN.py 100 RBM

python trainNN.py 100 Auto

python trainNN.py 100 DenoAuto

python trainNN.py 100 Random

See the directory NNout/ for sample output.

rbm_ae's People

Contributors

lingxuez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.