diff --git a/Tutorial.ipynb b/Tutorial.ipynb index 862db3d..f9cefed 100644 --- a/Tutorial.ipynb +++ b/Tutorial.ipynb @@ -49,9 +49,7 @@ " positive = list(filter(lambda x: x.sentiment == Sentiment.POSITIVE, self.reviews))\n", " positive_shrunk = positive[:len(negative)]\n", " self.reviews = negative + positive_shrunk\n", - " random.shuffle(self.reviews)\n", - " \n", - " " + " random.shuffle(self.reviews)" ] }, { @@ -80,7 +78,7 @@ "source": [ "import json\n", "\n", - "file_name = './data/sentiment/books_small_10000.json'\n", + "file_name = './data/sentiment/Books_small_10000.json'\n", "\n", "reviews = []\n", "with open(file_name) as f:\n", @@ -88,8 +86,7 @@ " review = json.loads(line)\n", " reviews.append(Review(review['reviewText'], review['overall']))\n", " \n", - "reviews[5].text\n", - " " + "reviews[5].text " ] }, { @@ -101,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -116,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -150,14 +147,14 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "I read this book over a year ago & enjoyed the various stories, the author takes you on a journey of life as it pretty much is in today's world & society, as you end one story you look forward to starting the next, relaxed reading I highly recommend it for peps who enjoy stories from back in their grand-ma & grand-dad days in the South. I will peruse more books by this author for future purchase.\n", + "I was very disappointed with this book, not up to snuff by Deaver. Too many filler words, too expensive. Not interesting.\n", "[[0. 0. 0. ... 0. 0. 0.]]\n" ] } @@ -174,10 +171,7 @@ "test_x_vectors = vectorizer.transform(test_x)\n", "\n", "print(train_x[0])\n", - "print(train_x_vectors[0].toarray())\n", - "\n", - "\n", - "\n" + "print(train_x_vectors[0].toarray())" ] }, { @@ -213,16 +207,16 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "array(['POSITIVE'], dtype='