Description Usage Arguments Value Examples
Trains a Restricted Boltzmann Machine on binary data, either supervised or unsupervised. This function uses contrastive diversion with k = 1 for training the system.
1 2 3 |
x |
A matrix with binary features of shape samples * features. |
y |
A matrix with labels for the data, only when training a classification RBM. (Optional) |
n.iter |
Defines the number of epochs to run contrastive diversion. |
n.hidden |
The number of nodes in the hidden layer. |
learning.rate |
The learning rate, alpha, for training the system. |
plot |
Whether to plot the learning progress of the weights |
size.minibatch |
The size of the minibatches used for training. |
momentum |
Speeds up the gradient descent learning. |
lambda |
The sparsity penalty lambda to prevent the system from overfitting. |
A list with the trained weights of the RBM that can be used for the predict RBM function when supervised learning was applied or the ReconstructRBM function to reconstruct data with the model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Load the MNIST data
data(MNIST)
# Fit unsupervised RBM with the MNIST data
modelRBM <- RBM(MNIST$trainX, n.iter = 1000, n.hidden = 30, learning.rate = 0.1,
plot = FALSE, size.minibatch = 10, momentum = 0.5, lambda = 0.001)
# Fit a supervised RBM with the MNIST data
modelRBMSup <- RBM(MNIST$trainX, MNIST$trainY, n.iter = 1000, n.hidden = 30, learning.rate = 0.1,
plot = FALSE, size.minibatch = 10, momentum = 0.5, lambda = 0.001)
# Add more weight decay when training more parameters
modelRBMSup <- RBM(MNIST$trainX, MNIST$trainY, n.iter = 1000, n.hidden = 100, learning.rate = 0.1,
plot = FALSE, size.minibatch = 10, momentum = 0.5, lambda = 0.1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.