From the course: Advanced NLP with Python for Machine Learning

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Preparing data for an RNN

Preparing data for an RNN - Python Tutorial

From the course: Advanced NLP with Python for Machine Learning

Start my 1-month free trial

Preparing data for an RNN

- [Instructor] In this video, we're going to learn how to prepare our data before actually implementing a basic RNN in the next video. So, we're going to start by reading our data In, and then splitting it into the training and test sets. Two things I want to call out. Previously, we used a simple pre-process function from Jensen in order to clean and tokenize our data. We're going to be using a different function from the package that we'll be using to do the modeling. So, we'll just leave the text in its raw form for now. Secondly, you'll notice that we're converting our label into a numeric form. So, we're saying if the label is spam, then set it equal to one. Otherwise, set it equal to zero. Then store that as a list called labels. Keras just expects our binary label to be in this form. So, we're going to be using a package called Keras to implement this RNN. Keras is a really nice package, that essentially runs on…

Contents