How it works...

In this recipe, we performed two training loops. The first was to fit the doc2vec embeddings, and the second loop was to fit the logistic regression on the movie sentiment.

While we did not increase the sentiment prediction accuracy by much (it is still slightly under 60%), we successfully implemented the concatenation version of doc2vec on the movie corpus. To increase our accuracy, we should try different parameters for the doc2vec embeddings and possibly a more complicated model, as logistic regression may not be able to capture all non-linear behavior in natural language.

Get TensorFlow Machine Learning Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.