Description Usage Arguments Details Value References Examples
This function fits an RBM to the input dataset. It internally uses sparse matricies for faster matrix operations
1 2 3 4 5 |
x |
a sparse matrix |
num_hidden |
number of neurons in the hidden layer |
max_epochs |
Maximum learning epochs |
learning_rate |
Learning Rate |
use_mini_batches |
Use sub-samples for training for each iteration. This usually results in MUCH faster learning. |
batch_size |
Sample size for mini batches |
initial_weights_mean |
Mean of initial random weights |
initial_weights_sd |
Standard deviation of initial random weights |
momentum |
Use momentum when learning. (Helps move faster through "half pipe" shaped regions). |
dropout |
Use dropout when learning (sort of a form of regularization). |
dropout_pct |
What percent of neurons to drop out (0 to 1) |
retx |
whether to return the RBM predictions for the input data |
activation_function |
function to convert hidden activations (-Inf, Inf) to hidden probabilities [0, 1]. Must be able to operate on sparse "Matrix" objects. |
verbose |
Print lots of messages while training |
... |
not used |
This code is (mostly) adapted from edwin chen's python code for RBMs, avaiable here: https://github.com/echen/restricted-boltzmann-machines. Some modifications (e.g. momentum) were adapted from Andrew Landgraf's R code for RBMs, available here: http://alandgraf.blogspot.com/2013/01/restricted-boltzmann-machines-in-r.html.
a rbm object
http://blog.echen.me/2011/07/18/introduction-to-restricted-boltzmann-machines
http://alandgraf.blogspot.com/2013/01/restricted-boltzmann-machines-in-r.html
http://web.info.uvt.ro/~dzaharie/cne2013/proiecte/tehnici/DeepLearning/DL_tutorialSlides.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ## Not run:
#Setup a dataset
set.seed(10)
data(movie_reviews)
data(george_reviews)
#Fit a PCA model and an RBM model
PCA <- prcomp(movie_reviews, retx=TRUE)
RBM <- rbm_gpu(movie_reviews, retx=TRUE)
#Examine the 2 models
round(PCA$rotation, 2) #PCA weights
round(RBM$rotation, 2) #RBM weights
#Predict for new data
predict(PCA, george_reviews)
predict(RBM, george_reviews, type='activations')
predict(RBM, george_reviews, type='probs')
predict(RBM, george_reviews, type='states')
#Predict for existing data
predict(PCA)
predict(RBM, type='probs')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.