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.

How to prep document vectors for modeling

How to prep document vectors for modeling - Python Tutorial

From the course: Advanced NLP with Python for Machine Learning

Start my 1-month free trial

How to prep document vectors for modeling

- [Instructor] Previously, we learned that document vectors do not take as much preparation to be passed into a machine learning model as word vectors do. Now that we know how to create document vectors, it'll be pretty straightforward to figure out how to prep those vectors for modeling. So a quickly run through everything that we've covered previously. We'll read in our data, clean it, split it into train and test set, and then we'll train our doc to vec model on our training set. As that's training, recall that we can create a document vector by passing a list of words into the infer_vector method for the trained model. Again, this returns a single vector of length 100 that is prepared to be passed directly into a machine learning model. So now that we have a trained model, we want to generate document vectors from our trained model for each text message in our test set. So we'll use list comprehension to loop through…

Contents