October 2018
Intermediate to advanced
472 pages
10h 57m
English
The dataset we'll use in this project is the Movie Review Data from Rotten Tomatoes (http://www.cs.cornell.edu/people/pabo/movie-review-data/). It contains 10,662 example review sentences, with approximately half of them positive and half negative. The dataset has a vocabulary of around 20,000 words. We will use the sklearn wrapper to load the dataset from a raw file and then a separate_dataset() helper function to clean the dataset and transform it from its raw form to the separate list structure:
#Helper functiondef separate_dataset(trainset,ratio=0.5): datastring = [] datatarget = [] for i in range(int(len(trainset.data)*ratio)): data_ = trainset.data[i].split('\n') data_ = list(filter(None, data_)) for n in range(len(data_)): ...Read now
Unlock full access