February 2018
Beginner to intermediate
258 pages
5h 47m
English
It's time to combine vector embeddings and neural networks to, hopefully, create more robust models. Let's do a simple extension to our workflow by training a neural network as a classifier. We start with the now familiar preprocessing and vector embedding:
library(plyr)library(dplyr)library(text2vec)library(tidytext)library(caret)library(tokenizers)imdb <- read.csv("./data/labeledTrainData.tsv" , encoding = "utf-8" , quote = "" , sep="\t" , stringsAsFactors = F)tokens <- tokenize_words(imdb$review, stopwords = stopwords())# Boring boilerplate preprocessingtoken_iterator <- itoken(tokens)vocab <- create_vocabulary(token_iterator)vocab <- prune_vocabulary(vocab, term_count_min = 5L)vectorizer <- vocab_vectorizer(vocab) ...Read now
Unlock full access