Skip to content

Commit f384db7

Browse files
committed
cleaned notebook
1 parent 3b553f3 commit f384db7

4 files changed

+48
-138
lines changed

.ipynb_checkpoints/3.EchoVariations_Analysis-checkpoint.ipynb

+3-17
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
"import seaborn as sns\n",
1414
"import matplotlib.pyplot as plt\n",
1515
"from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer\n",
16-
"from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer\n",
17-
"from sklearn.model_selection import train_test_split\n",
18-
"from sklearn.linear_model import LogisticRegression\n",
19-
"from sklearn.metrics import classification_report, confusion_matrix, roc_auc_score, roc_curve, auc, log_loss\n",
2016
"import plotly.express as px\n",
2117
"import plotly.graph_objects as go\n",
2218
"import pickle"
@@ -239,7 +235,7 @@
239235
}
240236
],
241237
"source": [
242-
"# REMOVE FIRE STICK AS IT IS NOT AN ALEXA DEVICE\n",
238+
"# REMOVE FIRE STICK AS IT IS NOT AN ECHO DEVICE\n",
243239
"df=df[df.variation!='Configuration: Fire TV Stick']\n",
244240
"df['variation'].value_counts()"
245241
]
@@ -7348,22 +7344,12 @@
73487344
"## Echo "
73497345
]
73507346
},
7351-
{
7352-
"cell_type": "code",
7353-
"execution_count": 30,
7354-
"metadata": {},
7355-
"outputs": [],
7356-
"source": [
7357-
"from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer\n"
7358-
]
7359-
},
73607347
{
73617348
"cell_type": "code",
73627349
"execution_count": 31,
73637350
"metadata": {},
73647351
"outputs": [],
73657352
"source": [
7366-
"analyser = SentimentIntensityAnalyzer()\n",
73677353
"def sentimentScore(sentences):\n",
73687354
" analyzer = SentimentIntensityAnalyzer()\n",
73697355
" results = []\n",
@@ -7519,7 +7505,7 @@
75197505
}
75207506
],
75217507
"source": [
7522-
"# echo plus\n",
7508+
"# ECHO\n",
75237509
"with open('Saved Models/echo.pkl','rb') as read_file:\n",
75247510
" echo= pickle.load(read_file)\n",
75257511
"\n",
@@ -10721,7 +10707,7 @@
1072110707
"cell_type": "code",
1072210708
"execution_count": 59,
1072310709
"metadata": {
10724-
"scrolled": true
10710+
"scrolled": false
1072510711
},
1072610712
"outputs": [
1072710713
{

.ipynb_checkpoints/4.Top3_Echo_Analysis-checkpoint.ipynb

+21-52
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,17 @@
88
"source": [
99
"from wordcloud import WordCloud, STOPWORDS\n",
1010
"import pandas as pd\n",
11-
"import numpy as np\n",
1211
"import pickle\n",
1312
"import seaborn as sns\n",
1413
"import matplotlib.pyplot as plt\n",
1514
"from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer\n",
1615
"from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer\n",
1716
"from sklearn.model_selection import train_test_split\n",
1817
"from sklearn.linear_model import LogisticRegression\n",
19-
"from sklearn.metrics import classification_report, confusion_matrix, roc_auc_score, roc_curve, auc, log_loss\n",
2018
"import gensim\n",
2119
"from gensim import corpora\n",
2220
"from gensim.models import LdaModel, LdaMulticore\n",
23-
"from gensim.utils import simple_preprocess, lemmatize\n",
2421
"from nltk.corpus import stopwords\n",
25-
"\n",
2622
"from gensim.models.word2vec import Word2Vec\n",
2723
"from multiprocessing import cpu_count\n",
2824
"import gensim.downloader as api"
@@ -8989,7 +8985,7 @@
89898985
"cell_type": "code",
89908986
"execution_count": 58,
89918987
"metadata": {
8992-
"scrolled": true
8988+
"scrolled": false
89938989
},
89948990
"outputs": [
89958991
{
@@ -9079,7 +9075,7 @@
90799075
"cell_type": "code",
90809076
"execution_count": 60,
90819077
"metadata": {
9082-
"scrolled": true
9078+
"scrolled": false
90839079
},
90849080
"outputs": [
90859081
{
@@ -18311,20 +18307,6 @@
1831118307
"# LDA"
1831218308
]
1831318309
},
18314-
{
18315-
"cell_type": "code",
18316-
"execution_count": 69,
18317-
"metadata": {},
18318-
"outputs": [],
18319-
"source": [
18320-
"import gensim\n",
18321-
"from gensim import corpora\n",
18322-
"from gensim.models import LdaModel, LdaMulticore\n",
18323-
"import gensim.downloader as api\n",
18324-
"from gensim.utils import simple_preprocess, lemmatize\n",
18325-
"from nltk.corpus import stopwords"
18326-
]
18327-
},
1832818310
{
1832918311
"cell_type": "code",
1833018312
"execution_count": 70,
@@ -18397,17 +18379,6 @@
1839718379
"# Word2Vec"
1839818380
]
1839918381
},
18400-
{
18401-
"cell_type": "code",
18402-
"execution_count": 73,
18403-
"metadata": {},
18404-
"outputs": [],
18405-
"source": [
18406-
"from gensim.models.word2vec import Word2Vec\n",
18407-
"from multiprocessing import cpu_count\n",
18408-
"import gensim.downloader as api"
18409-
]
18410-
},
1841118382
{
1841218383
"cell_type": "code",
1841318384
"execution_count": 74,
@@ -19890,8 +19861,6 @@
1989019861
"metadata": {},
1989119862
"outputs": [],
1989219863
"source": [
19893-
"from sklearn.feature_selection import chi2\n",
19894-
"\n",
1989519864
"tfidf_n = TfidfVectorizer(ngram_range=(2, 2))\n",
1989619865
"X_tfidf_n = tfidf_n.fit_transform(neg_alexa['new_reviews'])\n",
1989719866
"y_n = neg_alexa['rating']\n",
@@ -19990,7 +19959,7 @@
1999019959
"cell_type": "code",
1999119960
"execution_count": 118,
1999219961
"metadata": {
19993-
"scrolled": true
19962+
"scrolled": false
1999419963
},
1999519964
"outputs": [
1999619965
{
@@ -20066,9 +20035,23 @@
2006620035
},
2006720036
{
2006820037
"cell_type": "code",
20069-
"execution_count": 86,
20070-
"metadata": {},
20071-
"outputs": [],
20038+
"execution_count": 1,
20039+
"metadata": {
20040+
"scrolled": true
20041+
},
20042+
"outputs": [
20043+
{
20044+
"ename": "NameError",
20045+
"evalue": "name 'pickle' is not defined",
20046+
"output_type": "error",
20047+
"traceback": [
20048+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
20049+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
20050+
"\u001b[0;32m<ipython-input-1-87645d35ad92>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Saved Models/echoshow.pkl'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'rb'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mread_file\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mechoshow\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpickle\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mread_file\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
20051+
"\u001b[0;31mNameError\u001b[0m: name 'pickle' is not defined"
20052+
]
20053+
}
20054+
],
2007220055
"source": [
2007320056
"with open('Saved Models/echoshow.pkl','rb') as read_file:\n",
2007420057
" echoshow = pickle.load(read_file)"
@@ -24129,20 +24112,6 @@
2412924112
"# LDA"
2413024113
]
2413124114
},
24132-
{
24133-
"cell_type": "code",
24134-
"execution_count": 94,
24135-
"metadata": {},
24136-
"outputs": [],
24137-
"source": [
24138-
"import gensim\n",
24139-
"from gensim import corpora\n",
24140-
"from gensim.models import LdaModel, LdaMulticore\n",
24141-
"import gensim.downloader as api\n",
24142-
"from gensim.utils import simple_preprocess, lemmatize\n",
24143-
"from nltk.corpus import stopwords"
24144-
]
24145-
},
2414624115
{
2414724116
"cell_type": "code",
2414824117
"execution_count": 95,
@@ -25064,7 +25033,7 @@
2506425033
"cell_type": "code",
2506525034
"execution_count": 107,
2506625035
"metadata": {
25067-
"scrolled": true
25036+
"scrolled": false
2506825037
},
2506925038
"outputs": [
2507025039
{

3.EchoVariations_Analysis.ipynb

+3-17
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
"import seaborn as sns\n",
1414
"import matplotlib.pyplot as plt\n",
1515
"from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer\n",
16-
"from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer\n",
17-
"from sklearn.model_selection import train_test_split\n",
18-
"from sklearn.linear_model import LogisticRegression\n",
19-
"from sklearn.metrics import classification_report, confusion_matrix, roc_auc_score, roc_curve, auc, log_loss\n",
2016
"import plotly.express as px\n",
2117
"import plotly.graph_objects as go\n",
2218
"import pickle"
@@ -239,7 +235,7 @@
239235
}
240236
],
241237
"source": [
242-
"# REMOVE FIRE STICK AS IT IS NOT AN ALEXA DEVICE\n",
238+
"# REMOVE FIRE STICK AS IT IS NOT AN ECHO DEVICE\n",
243239
"df=df[df.variation!='Configuration: Fire TV Stick']\n",
244240
"df['variation'].value_counts()"
245241
]
@@ -7348,22 +7344,12 @@
73487344
"## Echo "
73497345
]
73507346
},
7351-
{
7352-
"cell_type": "code",
7353-
"execution_count": 30,
7354-
"metadata": {},
7355-
"outputs": [],
7356-
"source": [
7357-
"from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer\n"
7358-
]
7359-
},
73607347
{
73617348
"cell_type": "code",
73627349
"execution_count": 31,
73637350
"metadata": {},
73647351
"outputs": [],
73657352
"source": [
7366-
"analyser = SentimentIntensityAnalyzer()\n",
73677353
"def sentimentScore(sentences):\n",
73687354
" analyzer = SentimentIntensityAnalyzer()\n",
73697355
" results = []\n",
@@ -7519,7 +7505,7 @@
75197505
}
75207506
],
75217507
"source": [
7522-
"# echo plus\n",
7508+
"# ECHO\n",
75237509
"with open('Saved Models/echo.pkl','rb') as read_file:\n",
75247510
" echo= pickle.load(read_file)\n",
75257511
"\n",
@@ -10721,7 +10707,7 @@
1072110707
"cell_type": "code",
1072210708
"execution_count": 59,
1072310709
"metadata": {
10724-
"scrolled": true
10710+
"scrolled": false
1072510711
},
1072610712
"outputs": [
1072710713
{

0 commit comments

Comments
 (0)