From the course: Advanced NLP with Python for Machine Learning

Unlock the full course today

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

Build a model on doc2vec embeddings

Build a model on doc2vec embeddings - Python Tutorial

From the course: Advanced NLP with Python for Machine Learning

Start my 1-month free trial

Build a model on doc2vec embeddings

- [Instructor] Let's dive in and see if Doc2Vec will provide any improvement over our baseline. Let's import the packages we need, and read in all of our data. Now remember from our chapter on Doc2Vec, we have to create this tagged document object before we can train our model. So it's cycled through the cleaned messages in our training and test sets, and will create our tagged document objects by passing in the words in the text message, and then passing in the index as a unique tag for the given text message. And then we'll store those in tagged_docs_train and tagged_docs_test. Now, let's go ahead and look at these tagged documents. So we'll call tagged_docs_train, tell it to print out the first 10. And again, you could see this words attribute is just a list of words in the given text message. And then the index is stored as the tag. Now let's go ahead and train our model, and we're going to use the same parameter…

Contents