Skip to Content
R Deep Learning Cookbook
book

R Deep Learning Cookbook

by PKS Prakash, Achyutuni Sri Krishna Rao
August 2017
Intermediate to advanced
288 pages
8h 6m
English
Packt Publishing
Content preview from R Deep Learning Cookbook

How to do it...

The section will provide steps to set-up an RNN model.

  1. Load the MNIST dataset:
# Load mnist dataset from tensorflow library 
datasets <- tf$contrib$learn$datasets 
mnist <- datasets$mnist$read_data_sets("MNIST-data", one_hot = TRUE) 
  1. Reset the graph and start an interactive session:
# Reset the graph and set-up a interactive session 
tf$reset_default_graph() 
sess<-tf$InteractiveSession() 
  1. Reduce image size to 16 x 16 pixels using the reduceImage function from Chapter 4, Data Representation using Autoencoders:
# Covert train data to 16 x 16  pixel image 
trainData<-t(apply(mnist$train$images, 1, FUN=reduceImage)) 
validData<-t(apply(mnist$test$images, 1, FUN=reduceImage)) 
 
  1. Extract labels for the defined train and valid ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Deep Learning with R Cookbook

Deep Learning with R Cookbook

Swarna Gupta, Rehan Ali Ansari, Dipayan Sarkar
The Deep Learning with Keras Workshop

The Deep Learning with Keras Workshop

Matthew Moocarme, Mahla Abdolahnejad, Ritesh Bhagwat
Deep Learning for Chest Radiographs

Deep Learning for Chest Radiographs

Yashvi Chandola, Jitendra Virmani, H.S Bhadauria, Papendra Kumar

Publisher Resources

ISBN: 9781787121089Supplemental Content