StackRBM: Stacked Restricted Boltzmann Machine

Description Usage Arguments Value Examples

Description

Function to stack several Restricted Boltzmann Machines, trained greedily by training a RBM (using the RBM function) at each layer and then using the output of that RBM to train the next layer RBM.

Usage

1
2
3
StackRBM(x, y, n.iter = 100, layers = c(100, 100, 30),
  learning.rate = 0.1, size.minibatch = 10, lambda = 0.1,
  momentum = 0.5)

Arguments

x

A matrix with binary features of shape samples * features.

y

A matrix with labels for the data, only when the last layer is a classification RBM. (Optional)

n.iter

Number of epochs for training each RBM layer.

layers

Vector with the number of hidden nodes for each RBM layer.

learning.rate

The learning rate for training each RBM layer.

size.minibatch

The size of the minibatches used for training.

lambda

The sparsity penalty lambda to prevent the system from overfitting.

momentum

Speeds up the gradient descent learning.

Value

A list with the trained weights of the stacked RBM that can be used for the predict RBM function when a classification RBM is at the top layer of the ReconstructRBM function to reconstruct data with the model.

Examples

1
2
3
4
5
6
7
8
# Load MNIST data
data(MNIST)

# Train a unsupervised Stack of 3 RBMs
mod <- StackRBM(MNIST$trainX, layers = c(100,100,100))

# Classification RBM as top layer
modSup <- StackRBM(MNIST$trainX, MNIST$trainY, layers = c(100,100,100))

TimoMatzen/RBM documentation built on June 1, 2019, 8:35 a.m.