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 (11 chapters)

Chapter 5. Sentiment Analysis with Word Embeddings

In this chapter, we turn to the problem of sentiment analysis. Sentiment analysis is an umbrella term for a number of techniques to figure out how a speaker feels about a certain topic or piece of content.

A vanilla case study of sentiment analysis is polarity. Given a document or text string (for instance, a Tweet, a review, or a comment on a social network), the aim is to determine whether the author feels good, bad, or neutral about the item or topic in question.  

At first look, this problem might seem trivial: A lookup table with positive and negative words, and simply counting the word frequencies should do, right? Not so fast. Here are a few examples of why this is tricky:

  • Their decadent desserts made me hate myself
  • You should try this place if you love cold food
  • Disliking cake is not really my thing

What can we see in these examples?

  • Negative terms used in a possibly positive sense
  • Positive terms used sarcastically
  • Two negative terms that...