How to do it...

This section covers detailed the steps for setting up the DRBM model using TensorFlow in R:

  1. Define the parameters for the DRBM:
learning_rate = 0.005momentum = 0.005minbatch_size = 25hidden_layers = c(400,100)biases = list(-1,-1)
  1. Define a sigmoid function using a hyperbolic arc tangent [(log(1+x) -log(1-x))/2]:
arcsigm <- function(x){return(atanh((2*x)-1)*2)}
  1. Define a sigmoid function using only a hyperbolic tangent [(ex-e-x)/(ex+e-x)]:
sigm <- function(x){return(tanh((x/2)+1)/2)}
  1. Define a binarize function to return a matrix of binary values (0,1):
binarize <- function(x){# truncated rnormtrnrom <- function(n, mean, sd, minval = -Inf, maxval = Inf){qnorm(runif(n, pnorm(minval, mean, sd), pnorm(maxval, mean, ...

Get R Deep Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.