{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "train=p.read_csv(\"kaggle-sentiment/train.tsv\", delimiter='\\t')\n", "y=train['Sentiment'].values\n", "X=train['Phrase'].values" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.5529026288030471 | B? F | CV: 2 | Classifier: BernoulliNB\n", "0.5531524365695574 | B? F | CV: 3 | Classifier: BernoulliNB\n", "0.5592720169584305 | B? F | CV: 2 | Classifier: MultinomialNB\n", "0.5595474569680894 | B? F | CV: 3 | Classifier: MultinomialNB\n", "0.5596116298457374 | B? T | CV: 2 | Classifier: MultinomialNB\n", "0.5601369637205256 | B? T | CV: 3 | Classifier: MultinomialNB\n" ] } ], "source": [ "from sklearn.pipeline import Pipeline\n", "from sklearn.feature_extraction.text import CountVectorizer\n", "from sklearn.model_selection import cross_val_score\n", "from sklearn.naive_bayes import BernoulliNB, MultinomialNB\n", "\n", "def runPipeline(classifier, boolean, cv):\n", " nb_clf_pipe = Pipeline([('vect', CountVectorizer(encoding='latin-1', binary=boolean)),('nb', classifier)])\n", " scores = cross_val_score(nb_clf_pipe, X, y, cv=cv)\n", " avg=sum(scores)/len(scores)\n", " pretty_line = \"{} | B? {} | CV: {} | Classifier: {}\"\n", " print(pretty_line.format(avg, str(boolean)[0], cv, str(classifier).split('(')[0]))\n", " \n", "runPipeline(BernoulliNB(), False, 2)\n", "runPipeline(BernoulliNB(), False, 3)\n", "runPipeline(MultinomialNB(), False, 2)\n", "runPipeline(MultinomialNB(), False, 3)\n", "runPipeline(MultinomialNB(), True, 2)\n", "runPipeline(MultinomialNB(), True, 3)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([1, 2, 2, ..., 3, 2, 2])" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "y" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv('hw6_data_sentiment.csv')" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
0PoNtokensnum_tokenssentencesnum_sentencesno_swnum_no_swtopwords_unfiltopwords_fil...v_pos_fdbowbow_noswdiy_cleanerprunednltk_negsunigram_featsbigram_featsbigram_feats_negno_shared_words
0I went to XYZ restaurant last week and I was v...N['i', 'went', 'to', 'xyz', 'restaurant', 'last...50['I went to XYZ restaurant last week and I was...3['went', 'xyz', 'restaurant', 'last', 'week', ...25[('was', 4), ('to', 3), ('i', 2), ('and', 2), ...[('went', 1), ('xyz', 1), ('restaurant', 1), (......0.186Counter({'was': 4, 'to': 3, 'i': 2, 'and': 2, ...Counter({'went': 1, 'xyz': 1, 'restaurant': 1,...i went to xyz restaurant last week and i was v...went restaurant last week very disappointed. f...['i', 'went', 'to', 'xyz', 'restaurant', 'last...['was', 'to', 'i', 'and', 'the', 'a_NEG', 'for...['i_went', 'went_to', 'to_xyz', 'xyz_restauran...['i_went', 'went_to', 'to_xyz', 'xyz_restauran...['i', 'to', 'xyz', 'week', 'and', 'i', 'was', ...
1In each of the diner dish there are at least o...N['in', 'each', 'of', 'the', 'diner', 'dish', '...78['In each of the diner dish there are at least...4['diner', 'dish', 'least', 'one', 'fly', 'wait...31[('the', 6), ('in', 4), ('to', 4), ('of', 3), ...[('want', 3), ('dish', 2), ('diner', 1), ('lea......0.042Counter({'the': 6, 'in': 4, 'to': 4, 'of': 3, ...Counter({'want': 3, 'dish': 2, 'diner': 1, 'le...in each of the diner dish there are at least o...each diner dish there least waiting hour dish ...['in', 'each', 'of', 'the', 'diner', 'dish', '...['to_NEG', 'the', 'want_NEG', 'the_NEG', 'in',...['in_each', 'each_of', 'of_the', 'the_diner', ...['in_each', 'each_of', 'of_the', 'the_diner', ...['in', 'of', 'the', 'diner', 'are', 'at', 'lea...
2This is the last place you would want to dine ...N['this', 'is', 'the', 'last', 'place', 'you', ...151['This is the last place you would want to din...7['last', 'place', 'would', 'want', 'dine', 'pr...61[('to', 10), ('the', 9), ('and', 7), ('we', 5)...[('minutes', 3), ('place', 2), ('price', 2), (......0.171Counter({'to': 10, 'the': 9, 'and': 7, 'we': 5...Counter({'minutes': 3, 'place': 2, 'price': 2,...this is the last place you would want to dine ...this last place would want dine price that exp...['this', 'is', 'the', 'last', 'place', 'you', ...['to_NEG', 'the_NEG', 'and_NEG', 'we_NEG', 'ha...['this_is', 'is_the', 'the_last', 'last_place'...['this_is', 'is_the', 'the_last', 'last_place'...['is', 'the', 'you', 'to', 'dine', 'at', 'the'...
3I went to this restaurant where I had ordered ...N['i', 'went', 'to', 'this', 'restaurant', 'whe...75['I went to this restaurant where I had ordere...6['went', 'restaurant', 'ordered', 'complimenta...33[('i', 6), ('the', 6), ('to', 3), ('for', 3), ...[('salad', 3), ('restaurant', 2), ('waiter', 2......0.162Counter({'i': 6, 'the': 6, 'to': 3, 'for': 3, ...Counter({'salad': 3, 'restaurant': 2, 'waiter'...i went to this restaurant where i had ordered ...went this restaurant where ordered complimenta...['i', 'went', 'to', 'this', 'restaurant', 'whe...['the', 'i', 'salad', 'had', 'for', 'waiter', ...['i_went', 'went_to', 'to_this', 'this_restaur...['i_went', 'went_to', 'to_this', 'this_restaur...['i', 'to', 'i', 'had', 'for', 'the', 'complim...
4I went there with two friends at 6pm. Long que...N['i', 'went', 'there', 'with', 'two', 'friends...73['I went there with two friends at 6pm.', 'Lon...10['went', 'two', 'friends', 'long', 'queue', 'd...38[('there', 3), ('but', 3), ('it', 3), ('a', 3)...[('two', 2), ('friends', 2), ('long', 2), ('di......0.353Counter({'there': 3, 'but': 3, 'it': 3, 'a': 3...Counter({'two': 2, 'friends': 2, 'long': 2, 'd...i went there with two friends at 6pm. long que...went there with friends 6pm. long queue there....['i', 'went', 'there', 'with', 'two', 'friends...['a_NEG', 'there', 'us_NEG', 'but_NEG', 'and_N...['i_went', 'went_there', 'there_with', 'with_t...['i_went', 'went_there', 'there_with', 'with_t...['i', 'two', 'at', 'queue', 'was', 'but', 'it'...
..................................................................
83This place was one of the best restaurant I ha...P['this', 'place', 'was', 'one', 'of', 'the', '...70['This place was one of the best restaurant I ...6['place', 'one', 'best', 'restaurant', 'price'...32[('the', 5), ('i', 3), ('and', 3), ('this', 2)...[('best', 2), ('area', 2), ('place', 1), ('one......0.300Counter({'the': 5, 'i': 3, 'and': 3, 'this': 2...Counter({'best': 2, 'area': 2, 'place': 1, 'on...this place was one of the best restaurant i ha...this place best restaurant have been. price li...['this', 'place', 'was', 'one', 'of', 'the', '...['the', 'i', 'and', 'this', 'best', 'is', 'are...['this_place', 'place_was', 'was_one', 'one_of...['this_place', 'place_was', 'was_one', 'one_of...['was', 'one', 'of', 'the', 'i', 'the', 'is', ...
84The best experience I ever had happened in Lon...P['the', 'best', 'experience', 'i', 'ever', 'ha...42['The best experience I ever had happened in L...3['best', 'experience', 'ever', 'happened', 'lo...21[('the', 3), ('in', 3), ('food', 2), ('a', 2),...[('food', 2), ('best', 1), ('experience', 1), ......0.283Counter({'the': 3, 'in': 3, 'food': 2, 'a': 2,...Counter({'food': 2, 'best': 1, 'experience': 1...the best experience i ever had happened in lon...best experience ever happened london britain. ...['the', 'best', 'experience', 'i', 'ever', 'ha...['in', 'the', 'best', 'experience', 'i', 'ever...['the_best', 'best_experience', 'experience_i'...['the_best', 'best_experience', 'experience_i'...['the', 'i', 'had', 'happened', 'in', 'london'...
85This Japanese restaurant is so popular recentl...P['this', 'japanese', 'restaurant', 'is', 'so',...88['This Japanese restaurant is so popular recen...12['japanese', 'restaurant', 'popular', 'recentl...49[('is', 4), ('the', 4), ('japanese', 2), ('a',...[('japanese', 2), ('food', 2), ('right', 2), (......0.462Counter({'is': 4, 'the': 4, 'japanese': 2, 'a'...Counter({'japanese': 2, 'food': 2, 'right': 2,...this japanese restaurant is so popular recentl...this japanese restaurant popular recently that...['this', 'japanese', 'restaurant', 'is', 'so',...['the_NEG', 'is_NEG', 'japanese', 'a', 'and_NE...['this_japanese', 'japanese_restaurant', 'rest...['this_japanese', 'japanese_restaurant', 'rest...['is', 'so', 'popular', 'recently', 'as', 'a',...
86Hibachi the grill is one of my favorite restau...P['hibachi', 'the', 'grill', 'is', 'one', 'of',...65['Hibachi the grill is one of my favorite rest...5['hibachi', 'grill', 'one', 'favorite', 'resta...30[('the', 8), ('is', 6), ('it', 3), ('hibachi',...[('hibachi', 2), ('grill', 2), ('restaurants',......0.388Counter({'the': 8, 'is': 6, 'it': 3, 'hibachi'...Counter({'hibachi': 2, 'grill': 2, 'restaurant...hibachi the grill is one of my favorite restau...hibachi grill favorite restaurants. like drama...['hibachi', 'the', 'grill', 'is', 'one', 'of',...['the', 'is', 'it', 'hibachi', 'grill', 'of', ...['hibachi_the', 'the_grill', 'grill_is', 'is_o...['hibachi_the', 'the_grill', 'grill_is', 'is_o...['hibachi', 'the', 'grill', 'is', 'one', 'of',...
87I went to this ultra-luxurious restaurant in D...P['i', 'went', 'to', 'this', 'restaurant', 'in'...63['I went to this ultra-luxurious restaurant in...5['went', 'restaurant', 'downtown', 'new', 'yor...35[('i', 4), ('this', 3), ('and', 3), ('restaura...[('restaurant', 2), ('expensive', 2), ('went',......0.223Counter({'i': 4, 'this': 3, 'and': 3, 'restaur...Counter({'restaurant': 2, 'expensive': 2, 'wen...i went to this ultra-luxurious restaurant in d...went this ultra-luxurious restaurant downtown ...['i', 'went', 'to', 'this', 'restaurant', 'in'...['i', 'this', 'and', 'restaurant', 'in', 'expe...['i_went', 'went_to', 'to_this', 'this_restaur...['i_went', 'went_to', 'to_this', 'this_restaur...['i', 'to', 'in', 'downtown', 'new', 'york', '...
\n", "

88 rows × 40 columns

\n", "
" ], "text/plain": [ " 0 PoN \\\n", "0 I went to XYZ restaurant last week and I was v... N \n", "1 In each of the diner dish there are at least o... N \n", "2 This is the last place you would want to dine ... N \n", "3 I went to this restaurant where I had ordered ... N \n", "4 I went there with two friends at 6pm. Long que... N \n", ".. ... .. \n", "83 This place was one of the best restaurant I ha... P \n", "84 The best experience I ever had happened in Lon... P \n", "85 This Japanese restaurant is so popular recentl... P \n", "86 Hibachi the grill is one of my favorite restau... P \n", "87 I went to this ultra-luxurious restaurant in D... P \n", "\n", " tokens num_tokens \\\n", "0 ['i', 'went', 'to', 'xyz', 'restaurant', 'last... 50 \n", "1 ['in', 'each', 'of', 'the', 'diner', 'dish', '... 78 \n", "2 ['this', 'is', 'the', 'last', 'place', 'you', ... 151 \n", "3 ['i', 'went', 'to', 'this', 'restaurant', 'whe... 75 \n", "4 ['i', 'went', 'there', 'with', 'two', 'friends... 73 \n", ".. ... ... \n", "83 ['this', 'place', 'was', 'one', 'of', 'the', '... 70 \n", "84 ['the', 'best', 'experience', 'i', 'ever', 'ha... 42 \n", "85 ['this', 'japanese', 'restaurant', 'is', 'so',... 88 \n", "86 ['hibachi', 'the', 'grill', 'is', 'one', 'of',... 65 \n", "87 ['i', 'went', 'to', 'this', 'restaurant', 'in'... 63 \n", "\n", " sentences num_sentences \\\n", "0 ['I went to XYZ restaurant last week and I was... 3 \n", "1 ['In each of the diner dish there are at least... 4 \n", "2 ['This is the last place you would want to din... 7 \n", "3 ['I went to this restaurant where I had ordere... 6 \n", "4 ['I went there with two friends at 6pm.', 'Lon... 10 \n", ".. ... ... \n", "83 ['This place was one of the best restaurant I ... 6 \n", "84 ['The best experience I ever had happened in L... 3 \n", "85 ['This Japanese restaurant is so popular recen... 12 \n", "86 ['Hibachi the grill is one of my favorite rest... 5 \n", "87 ['I went to this ultra-luxurious restaurant in... 5 \n", "\n", " no_sw num_no_sw \\\n", "0 ['went', 'xyz', 'restaurant', 'last', 'week', ... 25 \n", "1 ['diner', 'dish', 'least', 'one', 'fly', 'wait... 31 \n", "2 ['last', 'place', 'would', 'want', 'dine', 'pr... 61 \n", "3 ['went', 'restaurant', 'ordered', 'complimenta... 33 \n", "4 ['went', 'two', 'friends', 'long', 'queue', 'd... 38 \n", ".. ... ... \n", "83 ['place', 'one', 'best', 'restaurant', 'price'... 32 \n", "84 ['best', 'experience', 'ever', 'happened', 'lo... 21 \n", "85 ['japanese', 'restaurant', 'popular', 'recentl... 49 \n", "86 ['hibachi', 'grill', 'one', 'favorite', 'resta... 30 \n", "87 ['went', 'restaurant', 'downtown', 'new', 'yor... 35 \n", "\n", " topwords_unfil \\\n", "0 [('was', 4), ('to', 3), ('i', 2), ('and', 2), ... \n", "1 [('the', 6), ('in', 4), ('to', 4), ('of', 3), ... \n", "2 [('to', 10), ('the', 9), ('and', 7), ('we', 5)... \n", "3 [('i', 6), ('the', 6), ('to', 3), ('for', 3), ... \n", "4 [('there', 3), ('but', 3), ('it', 3), ('a', 3)... \n", ".. ... \n", "83 [('the', 5), ('i', 3), ('and', 3), ('this', 2)... \n", "84 [('the', 3), ('in', 3), ('food', 2), ('a', 2),... \n", "85 [('is', 4), ('the', 4), ('japanese', 2), ('a',... \n", "86 [('the', 8), ('is', 6), ('it', 3), ('hibachi',... \n", "87 [('i', 4), ('this', 3), ('and', 3), ('restaura... \n", "\n", " topwords_fil ... v_pos_fd \\\n", "0 [('went', 1), ('xyz', 1), ('restaurant', 1), (... ... 0.186 \n", "1 [('want', 3), ('dish', 2), ('diner', 1), ('lea... ... 0.042 \n", "2 [('minutes', 3), ('place', 2), ('price', 2), (... ... 0.171 \n", "3 [('salad', 3), ('restaurant', 2), ('waiter', 2... ... 0.162 \n", "4 [('two', 2), ('friends', 2), ('long', 2), ('di... ... 0.353 \n", ".. ... ... ... \n", "83 [('best', 2), ('area', 2), ('place', 1), ('one... ... 0.300 \n", "84 [('food', 2), ('best', 1), ('experience', 1), ... ... 0.283 \n", "85 [('japanese', 2), ('food', 2), ('right', 2), (... ... 0.462 \n", "86 [('hibachi', 2), ('grill', 2), ('restaurants',... ... 0.388 \n", "87 [('restaurant', 2), ('expensive', 2), ('went',... ... 0.223 \n", "\n", " bow \\\n", "0 Counter({'was': 4, 'to': 3, 'i': 2, 'and': 2, ... \n", "1 Counter({'the': 6, 'in': 4, 'to': 4, 'of': 3, ... \n", "2 Counter({'to': 10, 'the': 9, 'and': 7, 'we': 5... \n", "3 Counter({'i': 6, 'the': 6, 'to': 3, 'for': 3, ... \n", "4 Counter({'there': 3, 'but': 3, 'it': 3, 'a': 3... \n", ".. ... \n", "83 Counter({'the': 5, 'i': 3, 'and': 3, 'this': 2... \n", "84 Counter({'the': 3, 'in': 3, 'food': 2, 'a': 2,... \n", "85 Counter({'is': 4, 'the': 4, 'japanese': 2, 'a'... \n", "86 Counter({'the': 8, 'is': 6, 'it': 3, 'hibachi'... \n", "87 Counter({'i': 4, 'this': 3, 'and': 3, 'restaur... \n", "\n", " bow_nosw \\\n", "0 Counter({'went': 1, 'xyz': 1, 'restaurant': 1,... \n", "1 Counter({'want': 3, 'dish': 2, 'diner': 1, 'le... \n", "2 Counter({'minutes': 3, 'place': 2, 'price': 2,... \n", "3 Counter({'salad': 3, 'restaurant': 2, 'waiter'... \n", "4 Counter({'two': 2, 'friends': 2, 'long': 2, 'd... \n", ".. ... \n", "83 Counter({'best': 2, 'area': 2, 'place': 1, 'on... \n", "84 Counter({'food': 2, 'best': 1, 'experience': 1... \n", "85 Counter({'japanese': 2, 'food': 2, 'right': 2,... \n", "86 Counter({'hibachi': 2, 'grill': 2, 'restaurant... \n", "87 Counter({'restaurant': 2, 'expensive': 2, 'wen... \n", "\n", " diy_cleaner \\\n", "0 i went to xyz restaurant last week and i was v... \n", "1 in each of the diner dish there are at least o... \n", "2 this is the last place you would want to dine ... \n", "3 i went to this restaurant where i had ordered ... \n", "4 i went there with two friends at 6pm. long que... \n", ".. ... \n", "83 this place was one of the best restaurant i ha... \n", "84 the best experience i ever had happened in lon... \n", "85 this japanese restaurant is so popular recentl... \n", "86 hibachi the grill is one of my favorite restau... \n", "87 i went to this ultra-luxurious restaurant in d... \n", "\n", " pruned \\\n", "0 went restaurant last week very disappointed. f... \n", "1 each diner dish there least waiting hour dish ... \n", "2 this last place would want dine price that exp... \n", "3 went this restaurant where ordered complimenta... \n", "4 went there with friends 6pm. long queue there.... \n", ".. ... \n", "83 this place best restaurant have been. price li... \n", "84 best experience ever happened london britain. ... \n", "85 this japanese restaurant popular recently that... \n", "86 hibachi grill favorite restaurants. like drama... \n", "87 went this ultra-luxurious restaurant downtown ... \n", "\n", " nltk_negs \\\n", "0 ['i', 'went', 'to', 'xyz', 'restaurant', 'last... \n", "1 ['in', 'each', 'of', 'the', 'diner', 'dish', '... \n", "2 ['this', 'is', 'the', 'last', 'place', 'you', ... \n", "3 ['i', 'went', 'to', 'this', 'restaurant', 'whe... \n", "4 ['i', 'went', 'there', 'with', 'two', 'friends... \n", ".. ... \n", "83 ['this', 'place', 'was', 'one', 'of', 'the', '... \n", "84 ['the', 'best', 'experience', 'i', 'ever', 'ha... \n", "85 ['this', 'japanese', 'restaurant', 'is', 'so',... \n", "86 ['hibachi', 'the', 'grill', 'is', 'one', 'of',... \n", "87 ['i', 'went', 'to', 'this', 'restaurant', 'in'... \n", "\n", " unigram_feats \\\n", "0 ['was', 'to', 'i', 'and', 'the', 'a_NEG', 'for... \n", "1 ['to_NEG', 'the', 'want_NEG', 'the_NEG', 'in',... \n", "2 ['to_NEG', 'the_NEG', 'and_NEG', 'we_NEG', 'ha... \n", "3 ['the', 'i', 'salad', 'had', 'for', 'waiter', ... \n", "4 ['a_NEG', 'there', 'us_NEG', 'but_NEG', 'and_N... \n", ".. ... \n", "83 ['the', 'i', 'and', 'this', 'best', 'is', 'are... \n", "84 ['in', 'the', 'best', 'experience', 'i', 'ever... \n", "85 ['the_NEG', 'is_NEG', 'japanese', 'a', 'and_NE... \n", "86 ['the', 'is', 'it', 'hibachi', 'grill', 'of', ... \n", "87 ['i', 'this', 'and', 'restaurant', 'in', 'expe... \n", "\n", " bigram_feats \\\n", "0 ['i_went', 'went_to', 'to_xyz', 'xyz_restauran... \n", "1 ['in_each', 'each_of', 'of_the', 'the_diner', ... \n", "2 ['this_is', 'is_the', 'the_last', 'last_place'... \n", "3 ['i_went', 'went_to', 'to_this', 'this_restaur... \n", "4 ['i_went', 'went_there', 'there_with', 'with_t... \n", ".. ... \n", "83 ['this_place', 'place_was', 'was_one', 'one_of... \n", "84 ['the_best', 'best_experience', 'experience_i'... \n", "85 ['this_japanese', 'japanese_restaurant', 'rest... \n", "86 ['hibachi_the', 'the_grill', 'grill_is', 'is_o... \n", "87 ['i_went', 'went_to', 'to_this', 'this_restaur... \n", "\n", " bigram_feats_neg \\\n", "0 ['i_went', 'went_to', 'to_xyz', 'xyz_restauran... \n", "1 ['in_each', 'each_of', 'of_the', 'the_diner', ... \n", "2 ['this_is', 'is_the', 'the_last', 'last_place'... \n", "3 ['i_went', 'went_to', 'to_this', 'this_restaur... \n", "4 ['i_went', 'went_there', 'there_with', 'with_t... \n", ".. ... \n", "83 ['this_place', 'place_was', 'was_one', 'one_of... \n", "84 ['the_best', 'best_experience', 'experience_i'... \n", "85 ['this_japanese', 'japanese_restaurant', 'rest... \n", "86 ['hibachi_the', 'the_grill', 'grill_is', 'is_o... \n", "87 ['i_went', 'went_to', 'to_this', 'this_restaur... \n", "\n", " no_shared_words \n", "0 ['i', 'to', 'xyz', 'week', 'and', 'i', 'was', ... \n", "1 ['in', 'of', 'the', 'diner', 'are', 'at', 'lea... \n", "2 ['is', 'the', 'you', 'to', 'dine', 'at', 'the'... \n", "3 ['i', 'to', 'i', 'had', 'for', 'the', 'complim... \n", "4 ['i', 'two', 'at', 'queue', 'was', 'but', 'it'... \n", ".. ... \n", "83 ['was', 'one', 'of', 'the', 'i', 'the', 'is', ... \n", "84 ['the', 'i', 'had', 'happened', 'in', 'london'... \n", "85 ['is', 'so', 'popular', 'recently', 'as', 'a',... \n", "86 ['hibachi', 'the', 'grill', 'is', 'one', 'of',... \n", "87 ['i', 'to', 'in', 'downtown', 'new', 'york', '... \n", "\n", "[88 rows x 40 columns]" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }