O'Reilly logo

R Deep Learning Cookbook by Achyutuni Sri Krishna Rao, Dr. PKS Prakash

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required