Book Image

R Deep Learning Projects

Book Image

R Deep Learning Projects

Overview of this book

R is a popular programming language used by statisticians and mathematicians for statistical analysis, and is popularly used for deep learning. Deep Learning, as we all know, is one of the trending topics today, and is finding practical applications in a lot of domains. This book demonstrates end-to-end implementations of five real-world projects on popular topics in deep learning such as handwritten digit recognition, traffic light detection, fraud detection, text generation, and sentiment analysis. You'll learn how to train effective neural networks in R—including convolutional neural networks, recurrent neural networks, and LSTMs—and apply them in practical scenarios. The book also highlights how neural networks can be trained using GPU capabilities. You will use popular R libraries and packages—such as MXNetR, H2O, deepnet, and more—to implement the projects. By the end of this book, you will have a better understanding of deep learning concepts and techniques and how to use them in a practical setting.
Table of Contents (7 chapters)

Bag of words benchmark

We came across one-hot embeddings while identifying fraudulent emails in Chapter 3, Fraud Detection with Autoencoders. The idea is to represent each word as a basis vector; that is, a vector with zeros except one coordinate. Hence, each document (a review in this case) is represented as a vector with ones and zeros. We went a bit further from that and used different weighting (tf-idf).

Let's revisit this model once again, but include n-grams instead of single words. This will be our benchmark for the more sophisticated word embeddings we will do later. 

Preparing the data

The data is a subset of the Stanford Large Movie Review dataset, originally published in:

Andrew L. Maas, Raymond E. Daly...