1. Data Storage Fundamentals
Activity 1.01: Creating a Text Classifier for Movie Reviews
Solution
- Create a new directory,
Activity01.01
, in theChapter01
directory to store the files for this activity. - Move the
aclImdb
folder to theDatasets
directory. - Open your Terminal (macOS or Linux) or Command Prompt (Windows), navigate to the
Chapter01
directory, and typejupyter notebook
. - In the Jupyter notebook, click the
Activity01.01
directory and create a new notebook file with a Python3 kernel. - Import the
os
library and arandom
library, and define where our training and test data is stored using four variables, as shown in the following code:import os import random dataset_train_pos_path = "../Datasets/aclImdb/train/pos/" dataset_train_neg_path = "../Datasets/aclImdb/train/neg/" dataset_test_pos_path = "../Datasets/aclImdb/test/pos/" dataset_test_neg_path = "../Datasets/aclImdb/test/neg/"
We have four variables: one for...