Datasets:

ArXiv:
DOI:
License:
Yiran Wang commited on
Commit
0eae2d5
·
1 Parent(s): 4647c8b
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. benchmark/NBspecific_1/NBspecific_1.ipynb +1258 -0
  2. benchmark/NBspecific_1/NBspecific_1_fixed.ipynb +1123 -0
  3. benchmark/NBspecific_1/NBspecific_1_reproduced.ipynb +1096 -0
  4. benchmark/NBspecific_1/README.md +22 -0
  5. {data → benchmark}/NBspecific_1/data/IMDB Dataset.csv +0 -0
  6. {data → benchmark}/NBspecific_10/NBspecific_10.ipynb +0 -0
  7. benchmark/NBspecific_10/NBspecific_10_fixed.ipynb +0 -0
  8. benchmark/NBspecific_10/NBspecific_10_reproduced.ipynb +0 -0
  9. benchmark/NBspecific_10/README.md +22 -0
  10. {data → benchmark}/NBspecific_10/data/Turbine_Data.csv +0 -0
  11. benchmark/NBspecific_11/NBspecific_11.ipynb +0 -0
  12. benchmark/NBspecific_11/NBspecific_11_fixed.ipynb +0 -0
  13. benchmark/NBspecific_11/NBspecific_11_reproduced.ipynb +698 -0
  14. benchmark/NBspecific_11/README.md +17 -0
  15. {data → benchmark}/NBspecific_11/data/cow.jpeg +0 -0
  16. benchmark/NBspecific_12/NBspecific_12.ipynb +1 -0
  17. benchmark/NBspecific_12/NBspecific_12_fixed.ipynb +0 -0
  18. benchmark/NBspecific_12/NBspecific_12_reproduced.ipynb +539 -0
  19. benchmark/NBspecific_12/README.md +41 -0
  20. {data → benchmark}/NBspecific_12/data/playground-series-s3e24/test.csv.zip +0 -0
  21. {data → benchmark}/NBspecific_12/data/playground-series-s3e24/train.csv.zip +0 -0
  22. {data → benchmark}/NBspecific_12/data/smoker-status-prediction-using-biosignals/test_dataset.csv.zip +0 -0
  23. {data → benchmark}/NBspecific_12/data/smoker-status-prediction-using-biosignals/train_dataset.csv.zip +0 -0
  24. benchmark/NBspecific_13/NBspecific_13.ipynb +1 -0
  25. benchmark/NBspecific_13/NBspecific_13_fixed.ipynb +909 -0
  26. benchmark/NBspecific_13/NBspecific_13_reproduced.ipynb +905 -0
  27. benchmark/NBspecific_13/README.md +17 -0
  28. {data → benchmark}/NBspecific_13/data/datareg_linear_300.csv +0 -0
  29. {data → benchmark}/NBspecific_13/data/geyser.csv +0 -0
  30. {data → benchmark}/NBspecific_13/data/heart.csv +0 -0
  31. benchmark/NBspecific_14/NBspecific_14.ipynb +1 -0
  32. benchmark/NBspecific_14/NBspecific_14_fixed.ipynb +483 -0
  33. benchmark/NBspecific_14/NBspecific_14_reproduced.ipynb +195 -0
  34. benchmark/NBspecific_14/README.md +22 -0
  35. {data → benchmark}/NBspecific_14/data/test.csv +0 -0
  36. {data → benchmark}/NBspecific_14/data/train.csv +0 -0
  37. benchmark/NBspecific_15/NBspecific_15.ipynb +0 -0
  38. benchmark/NBspecific_15/NBspecific_15_fixed.ipynb +0 -0
  39. benchmark/NBspecific_15/NBspecific_15_reproduced.ipynb +0 -0
  40. benchmark/NBspecific_15/README.md +22 -0
  41. {data → benchmark}/NBspecific_15/data_small/src_images/img-0.jpg +0 -0
  42. {data → benchmark}/NBspecific_15/data_small/src_images/img-1.jpg +0 -0
  43. {data → benchmark}/NBspecific_15/data_small/src_images/img-10.jpg +0 -0
  44. {data → benchmark}/NBspecific_15/data_small/src_images/img-100.jpg +0 -0
  45. {data → benchmark}/NBspecific_15/data_small/src_images/img-1000.jpg +0 -0
  46. {data → benchmark}/NBspecific_15/data_small/src_images/img-1001.jpg +0 -0
  47. {data → benchmark}/NBspecific_15/data_small/src_images/img-1002.jpg +0 -0
  48. {data → benchmark}/NBspecific_15/data_small/src_images/img-1003.jpg +0 -0
  49. {data → benchmark}/NBspecific_15/data_small/src_images/img-1004.jpg +0 -0
  50. {data → benchmark}/NBspecific_15/data_small/src_images/img-1005.jpg +0 -0
benchmark/NBspecific_1/NBspecific_1.ipynb ADDED
@@ -0,0 +1,1258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 2,
6
+ "metadata": {
7
+ "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
8
+ "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
9
+ "execution": {
10
+ "iopub.execute_input": "2023-02-28T09:01:35.199038Z",
11
+ "iopub.status.busy": "2023-02-28T09:01:35.198153Z",
12
+ "iopub.status.idle": "2023-02-28T09:01:35.214562Z",
13
+ "shell.execute_reply": "2023-02-28T09:01:35.213234Z",
14
+ "shell.execute_reply.started": "2023-02-28T09:01:35.198993Z"
15
+ }
16
+ },
17
+ "outputs": [
18
+ {
19
+ "name": "stdout",
20
+ "output_type": "stream",
21
+ "text": [
22
+ "/kaggle/input/imdb-dataset-of-50k-movie-reviews/IMDB Dataset.csv\n"
23
+ ]
24
+ }
25
+ ],
26
+ "source": [
27
+ "# This Python 3 environment comes with many helpful analytics libraries installed\n",
28
+ "# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n",
29
+ "# For example, here's several helpful packages to load\n",
30
+ "\n",
31
+ "import numpy as np # linear algebra\n",
32
+ "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
33
+ "\n",
34
+ "# Input data files are available in the read-only \"../input/\" directory\n",
35
+ "# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n",
36
+ "\n",
37
+ "import os\n",
38
+ "for dirname, _, filenames in os.walk('/kaggle/input'):\n",
39
+ " for filename in filenames:\n",
40
+ " print(os.path.join(dirname, filename))\n",
41
+ "\n",
42
+ "# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n",
43
+ "# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session"
44
+ ]
45
+ },
46
+ {
47
+ "cell_type": "code",
48
+ "execution_count": 3,
49
+ "metadata": {
50
+ "execution": {
51
+ "iopub.execute_input": "2023-02-28T09:01:37.498012Z",
52
+ "iopub.status.busy": "2023-02-28T09:01:37.497070Z",
53
+ "iopub.status.idle": "2023-02-28T09:01:37.502150Z",
54
+ "shell.execute_reply": "2023-02-28T09:01:37.501011Z",
55
+ "shell.execute_reply.started": "2023-02-28T09:01:37.497972Z"
56
+ }
57
+ },
58
+ "outputs": [],
59
+ "source": [
60
+ "import re # Regular expression"
61
+ ]
62
+ },
63
+ {
64
+ "cell_type": "markdown",
65
+ "metadata": {},
66
+ "source": [
67
+ "## 1. Data Accqasation\n",
68
+ "This notebook will do basic IMDB reviews sentiment analysis. As show in below image, we will be performing few text cleaning and model building techniques. The flow of the notebook."
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": 4,
74
+ "metadata": {
75
+ "execution": {
76
+ "iopub.execute_input": "2023-02-28T09:01:40.837603Z",
77
+ "iopub.status.busy": "2023-02-28T09:01:40.836859Z",
78
+ "iopub.status.idle": "2023-02-28T09:01:42.179878Z",
79
+ "shell.execute_reply": "2023-02-28T09:01:42.178776Z",
80
+ "shell.execute_reply.started": "2023-02-28T09:01:40.837558Z"
81
+ }
82
+ },
83
+ "outputs": [
84
+ {
85
+ "data": {
86
+ "text/html": [
87
+ "<div>\n",
88
+ "<style scoped>\n",
89
+ " .dataframe tbody tr th:only-of-type {\n",
90
+ " vertical-align: middle;\n",
91
+ " }\n",
92
+ "\n",
93
+ " .dataframe tbody tr th {\n",
94
+ " vertical-align: top;\n",
95
+ " }\n",
96
+ "\n",
97
+ " .dataframe thead th {\n",
98
+ " text-align: right;\n",
99
+ " }\n",
100
+ "</style>\n",
101
+ "<table border=\"1\" class=\"dataframe\">\n",
102
+ " <thead>\n",
103
+ " <tr style=\"text-align: right;\">\n",
104
+ " <th></th>\n",
105
+ " <th>review</th>\n",
106
+ " <th>sentiment</th>\n",
107
+ " </tr>\n",
108
+ " </thead>\n",
109
+ " <tbody>\n",
110
+ " <tr>\n",
111
+ " <th>0</th>\n",
112
+ " <td>One of the other reviewers has mentioned that ...</td>\n",
113
+ " <td>positive</td>\n",
114
+ " </tr>\n",
115
+ " <tr>\n",
116
+ " <th>1</th>\n",
117
+ " <td>A wonderful little production. &lt;br /&gt;&lt;br /&gt;The...</td>\n",
118
+ " <td>positive</td>\n",
119
+ " </tr>\n",
120
+ " <tr>\n",
121
+ " <th>2</th>\n",
122
+ " <td>I thought this was a wonderful way to spend ti...</td>\n",
123
+ " <td>positive</td>\n",
124
+ " </tr>\n",
125
+ " <tr>\n",
126
+ " <th>3</th>\n",
127
+ " <td>Basically there's a family where a little boy ...</td>\n",
128
+ " <td>negative</td>\n",
129
+ " </tr>\n",
130
+ " <tr>\n",
131
+ " <th>4</th>\n",
132
+ " <td>Petter Mattei's \"Love in the Time of Money\" is...</td>\n",
133
+ " <td>positive</td>\n",
134
+ " </tr>\n",
135
+ " </tbody>\n",
136
+ "</table>\n",
137
+ "</div>"
138
+ ],
139
+ "text/plain": [
140
+ " review sentiment\n",
141
+ "0 One of the other reviewers has mentioned that ... positive\n",
142
+ "1 A wonderful little production. <br /><br />The... positive\n",
143
+ "2 I thought this was a wonderful way to spend ti... positive\n",
144
+ "3 Basically there's a family where a little boy ... negative\n",
145
+ "4 Petter Mattei's \"Love in the Time of Money\" is... positive"
146
+ ]
147
+ },
148
+ "execution_count": 4,
149
+ "metadata": {},
150
+ "output_type": "execute_result"
151
+ }
152
+ ],
153
+ "source": [
154
+ "df = pd.read_csv(\"/kaggle/input/imdb-dataset-of-50k-movie-reviews/IMDB Dataset.csv\")\n",
155
+ "df.head()"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "markdown",
160
+ "metadata": {},
161
+ "source": [
162
+ "## 1. Text Preprocessing\n",
163
+ "- Lower casing\n",
164
+ "- Remove HTML Tags\n",
165
+ "- Remove Punctuations\n",
166
+ "- Remove Stopwords\n",
167
+ "- Steamming and Lemmatization\n",
168
+ "- Observation"
169
+ ]
170
+ },
171
+ {
172
+ "cell_type": "code",
173
+ "execution_count": 5,
174
+ "metadata": {
175
+ "execution": {
176
+ "iopub.execute_input": "2023-02-28T09:01:44.623338Z",
177
+ "iopub.status.busy": "2023-02-28T09:01:44.622496Z",
178
+ "iopub.status.idle": "2023-02-28T09:01:44.635713Z",
179
+ "shell.execute_reply": "2023-02-28T09:01:44.634598Z",
180
+ "shell.execute_reply.started": "2023-02-28T09:01:44.623294Z"
181
+ }
182
+ },
183
+ "outputs": [
184
+ {
185
+ "data": {
186
+ "text/plain": [
187
+ "0 One of the other reviewers has mentioned that ...\n",
188
+ "1 A wonderful little production. <br /><br />The...\n",
189
+ "2 I thought this was a wonderful way to spend ti...\n",
190
+ "3 Basically there's a family where a little boy ...\n",
191
+ "4 Petter Mattei's \"Love in the Time of Money\" is...\n",
192
+ " ... \n",
193
+ "49995 I thought this movie did a down right good job...\n",
194
+ "49996 Bad plot, bad dialogue, bad acting, idiotic di...\n",
195
+ "49997 I am a Catholic taught in parochial elementary...\n",
196
+ "49998 I'm going to have to disagree with the previou...\n",
197
+ "49999 No one expects the Star Trek movies to be high...\n",
198
+ "Name: review, Length: 50000, dtype: object"
199
+ ]
200
+ },
201
+ "execution_count": 5,
202
+ "metadata": {},
203
+ "output_type": "execute_result"
204
+ }
205
+ ],
206
+ "source": [
207
+ "df['review']"
208
+ ]
209
+ },
210
+ {
211
+ "cell_type": "markdown",
212
+ "metadata": {},
213
+ "source": [
214
+ "### - Lowercasing all the Data"
215
+ ]
216
+ },
217
+ {
218
+ "cell_type": "code",
219
+ "execution_count": 6,
220
+ "metadata": {
221
+ "execution": {
222
+ "iopub.execute_input": "2023-02-28T09:01:46.978097Z",
223
+ "iopub.status.busy": "2023-02-28T09:01:46.977348Z",
224
+ "iopub.status.idle": "2023-02-28T09:01:47.121675Z",
225
+ "shell.execute_reply": "2023-02-28T09:01:47.120539Z",
226
+ "shell.execute_reply.started": "2023-02-28T09:01:46.978052Z"
227
+ }
228
+ },
229
+ "outputs": [],
230
+ "source": [
231
+ "# Apply all the preprocessing techniques\n",
232
+ "\n",
233
+ "# Convert all the text to lowercase\n",
234
+ "df['review'] = df['review'].str.lower()"
235
+ ]
236
+ },
237
+ {
238
+ "cell_type": "markdown",
239
+ "metadata": {},
240
+ "source": [
241
+ "### - Removeing HTML tags from Data"
242
+ ]
243
+ },
244
+ {
245
+ "cell_type": "code",
246
+ "execution_count": 7,
247
+ "metadata": {
248
+ "execution": {
249
+ "iopub.execute_input": "2023-02-28T09:01:49.177674Z",
250
+ "iopub.status.busy": "2023-02-28T09:01:49.176927Z",
251
+ "iopub.status.idle": "2023-02-28T09:01:49.395393Z",
252
+ "shell.execute_reply": "2023-02-28T09:01:49.394319Z",
253
+ "shell.execute_reply.started": "2023-02-28T09:01:49.177633Z"
254
+ }
255
+ },
256
+ "outputs": [],
257
+ "source": [
258
+ "# Removing HTML Tags\n",
259
+ "def remove_html_tags(text):\n",
260
+ " clean = re.compile('<.*?>')\n",
261
+ " return re.sub(clean, '', text)\n",
262
+ "\n",
263
+ "df['review'] = df['review'].apply(remove_html_tags)"
264
+ ]
265
+ },
266
+ {
267
+ "cell_type": "markdown",
268
+ "metadata": {},
269
+ "source": [
270
+ "### - Removing URLs from Texts"
271
+ ]
272
+ },
273
+ {
274
+ "cell_type": "code",
275
+ "execution_count": 8,
276
+ "metadata": {
277
+ "execution": {
278
+ "iopub.execute_input": "2023-02-28T09:01:52.159195Z",
279
+ "iopub.status.busy": "2023-02-28T09:01:52.158402Z",
280
+ "iopub.status.idle": "2023-02-28T09:01:52.674649Z",
281
+ "shell.execute_reply": "2023-02-28T09:01:52.673548Z",
282
+ "shell.execute_reply.started": "2023-02-28T09:01:52.159151Z"
283
+ }
284
+ },
285
+ "outputs": [],
286
+ "source": [
287
+ "# Removing URLs from Texts\n",
288
+ "def remove_urls(text):\n",
289
+ " clean = re.compile(r'http\\S+|www.\\S+')\n",
290
+ " return re.sub(clean, '', text)\n",
291
+ "\n",
292
+ "df['review'] = df['review'].apply(remove_urls)"
293
+ ]
294
+ },
295
+ {
296
+ "cell_type": "markdown",
297
+ "metadata": {},
298
+ "source": [
299
+ "### - Removing Punctuations from Data"
300
+ ]
301
+ },
302
+ {
303
+ "cell_type": "code",
304
+ "execution_count": 9,
305
+ "metadata": {
306
+ "execution": {
307
+ "iopub.execute_input": "2023-02-28T09:01:54.689274Z",
308
+ "iopub.status.busy": "2023-02-28T09:01:54.687886Z",
309
+ "iopub.status.idle": "2023-02-28T09:01:55.752957Z",
310
+ "shell.execute_reply": "2023-02-28T09:01:55.751887Z",
311
+ "shell.execute_reply.started": "2023-02-28T09:01:54.689212Z"
312
+ }
313
+ },
314
+ "outputs": [],
315
+ "source": [
316
+ "import string\n",
317
+ "exclude = string.punctuation\n",
318
+ "\n",
319
+ "# Remove punctuation \n",
320
+ "def remove_punc(text):\n",
321
+ " return text.translate(str.maketrans('','',exclude))\n",
322
+ "\n",
323
+ "df['review'] = df['review'].apply(remove_punc) "
324
+ ]
325
+ },
326
+ {
327
+ "cell_type": "markdown",
328
+ "metadata": {},
329
+ "source": [
330
+ "### - Chart word treatments(short form sms_slangs)"
331
+ ]
332
+ },
333
+ {
334
+ "cell_type": "code",
335
+ "execution_count": 10,
336
+ "metadata": {
337
+ "execution": {
338
+ "iopub.execute_input": "2023-02-28T09:01:58.088137Z",
339
+ "iopub.status.busy": "2023-02-28T09:01:58.087588Z",
340
+ "iopub.status.idle": "2023-02-28T09:01:58.102145Z",
341
+ "shell.execute_reply": "2023-02-28T09:01:58.100570Z",
342
+ "shell.execute_reply.started": "2023-02-28T09:01:58.088094Z"
343
+ }
344
+ },
345
+ "outputs": [],
346
+ "source": [
347
+ "chart_words = {\"AFAIK\":\"As Far As I Know\",\n",
348
+ "'AFK':'Away From Keyboard',\n",
349
+ "'ASAP':'As Soon As Possible',\n",
350
+ "'ATK':'At The Keyboard',\n",
351
+ "'ATM':'At The Moment',\n",
352
+ "'A3':'Anytime, Anywhere, Anyplace',\n",
353
+ "'BAK':'Back At Keyboard',\n",
354
+ "'BBL':'Be Back Later',\n",
355
+ "'BBS':'Be Back Soon',\n",
356
+ "'BFN':'Bye For Now',\n",
357
+ "'B4N':'Bye For Now',\n",
358
+ "'BRB':'Be Right Back',\n",
359
+ "'BRT':'Be Right There',\n",
360
+ "'BTW':'By The Way',\n",
361
+ "'B4':'Before',\n",
362
+ "'B4N':'Bye For Now',\n",
363
+ "'CU':'See You',\n",
364
+ "'CUL8R':'See You Later',\n",
365
+ "'CYA':'See You',\n",
366
+ "'FAQ':'Frequently Asked Questions',\n",
367
+ "'FC':'Fingers Crossed',\n",
368
+ "\"FWIW\":\"For What It's Worth\",\n",
369
+ "\"FYI\":\"For Your Information\",\n",
370
+ "\"GAL\":\"Get A Life\",\n",
371
+ "\"GG\":\"Good Game\",\n",
372
+ "\"GN\":\"Good Night\",\n",
373
+ "\"GMTA\":\"Great Minds Think Alike\",\n",
374
+ "\"GR8\":\"Great\",\n",
375
+ "\"G9\":\"Genius\",\n",
376
+ "\"IC\":\"I See\",\n",
377
+ "\"ICQ\":\"I Seek you\",\n",
378
+ "\"ILU\":\"I Love You\",\n",
379
+ "\"IMHO\":\"In My Honest/Humble Opinion\",\n",
380
+ "\"IMO\":\"In My Opinion\",\n",
381
+ "\"IOW\":\"In Other Words\",\n",
382
+ "\"IRL\":\"In Real Life\",\n",
383
+ "\"KISS\":\"Keep It Simple Stupid\",\n",
384
+ "\"LDR\":\"Long Distance Relationship\",\n",
385
+ "\"LMAO\":\"Laugh My A Off\",\n",
386
+ "\"LOL\":\"Laughing Out Loud\",\n",
387
+ "\"LTNS\":\"Long Time No See\",\n",
388
+ "\"L8R\":\"Later\",\n",
389
+ "\"MTE\":\"My Thoughts Exactly\",\n",
390
+ "\"M8\":\"Mate\",\n",
391
+ "\"NRN\":\"No Reply Necessary\",\n",
392
+ "\"OIC\":\"Oh I See\",\n",
393
+ "\"PITA\":\"Pain In The A\",\n",
394
+ "\"PRT\":\"Party\",\n",
395
+ "\"PRW\":\"Parents Are Watching\",\n",
396
+ "\"QPSA\":\"Que Pasa?\",\n",
397
+ "\"ROFL\":\"Rolling On The Floor Laughing\",\n",
398
+ "\"ROFLOL\":\"Rolling On The Floor Laughing Out Loud\",\n",
399
+ "\"ROTFLMAO\":\"Rolling On The Floor Laughing My A Off\",\n",
400
+ "\"SK8\":\"Skate\",\n",
401
+ "\"STATS\":\"Your sex and age\",\n",
402
+ "\"ASL\":\"Age, Sex, Location\",\n",
403
+ "\"THX\":\"Thank You\",\n",
404
+ "\"TTFN\":\"Ta-Ta For Now\",\n",
405
+ "\"TTYL\":\"Talk To You Later\",\n",
406
+ "\"U\":\"You\",\n",
407
+ "\"U2\":\"You Too\",\n",
408
+ "\"U4E\":\"Yours For Ever\",\n",
409
+ "\"WB\":\"Welcome Back\",\n",
410
+ "\"WTF\":\"What The F\",\n",
411
+ "\"WTG\":\"Way To Go\",\n",
412
+ "\"WUF\":\"Where Are You From\",\n",
413
+ "'W8':'Wait',\n",
414
+ "'7K':'Sick D Laugher'}"
415
+ ]
416
+ },
417
+ {
418
+ "cell_type": "code",
419
+ "execution_count": 11,
420
+ "metadata": {
421
+ "execution": {
422
+ "iopub.execute_input": "2023-02-28T09:01:59.138690Z",
423
+ "iopub.status.busy": "2023-02-28T09:01:59.138079Z",
424
+ "iopub.status.idle": "2023-02-28T09:01:59.148390Z",
425
+ "shell.execute_reply": "2023-02-28T09:01:59.147289Z",
426
+ "shell.execute_reply.started": "2023-02-28T09:01:59.138632Z"
427
+ }
428
+ },
429
+ "outputs": [],
430
+ "source": [
431
+ "def chart_conversations(text):\n",
432
+ " new_text = []\n",
433
+ " for w in text.split():\n",
434
+ " if w.upper() in chart_words:\n",
435
+ " new_text.append(chart_words[w.upper()])\n",
436
+ " else:\n",
437
+ " new_text.append(w)\n",
438
+ " return \" \".join(new_text)"
439
+ ]
440
+ },
441
+ {
442
+ "cell_type": "code",
443
+ "execution_count": 12,
444
+ "metadata": {
445
+ "execution": {
446
+ "iopub.execute_input": "2023-02-28T09:02:01.222894Z",
447
+ "iopub.status.busy": "2023-02-28T09:02:01.221976Z",
448
+ "iopub.status.idle": "2023-02-28T09:02:01.230050Z",
449
+ "shell.execute_reply": "2023-02-28T09:02:01.228866Z",
450
+ "shell.execute_reply.started": "2023-02-28T09:02:01.222848Z"
451
+ }
452
+ },
453
+ "outputs": [
454
+ {
455
+ "data": {
456
+ "text/plain": [
457
+ "'Hello , Where Are You From , See You Later , Frequently Asked Questions , Be Back Later'"
458
+ ]
459
+ },
460
+ "execution_count": 12,
461
+ "metadata": {},
462
+ "output_type": "execute_result"
463
+ }
464
+ ],
465
+ "source": [
466
+ "nm = \"Hello , WUF , CUL8R , FAQ , BBL\"\n",
467
+ "chart_conversations(nm)"
468
+ ]
469
+ },
470
+ {
471
+ "cell_type": "markdown",
472
+ "metadata": {},
473
+ "source": [
474
+ "### - Spelling Correction:(spcy, textbolb, pyspellchecker)"
475
+ ]
476
+ },
477
+ {
478
+ "cell_type": "code",
479
+ "execution_count": 13,
480
+ "metadata": {
481
+ "execution": {
482
+ "iopub.execute_input": "2023-02-28T09:02:05.938121Z",
483
+ "iopub.status.busy": "2023-02-28T09:02:05.936910Z",
484
+ "iopub.status.idle": "2023-02-28T09:02:06.457439Z",
485
+ "shell.execute_reply": "2023-02-28T09:02:06.456315Z",
486
+ "shell.execute_reply.started": "2023-02-28T09:02:05.938064Z"
487
+ }
488
+ },
489
+ "outputs": [],
490
+ "source": [
491
+ "from textblob import TextBlob"
492
+ ]
493
+ },
494
+ {
495
+ "cell_type": "code",
496
+ "execution_count": 14,
497
+ "metadata": {
498
+ "execution": {
499
+ "iopub.execute_input": "2023-02-28T09:02:08.338208Z",
500
+ "iopub.status.busy": "2023-02-28T09:02:08.337106Z",
501
+ "iopub.status.idle": "2023-02-28T09:02:09.128963Z",
502
+ "shell.execute_reply": "2023-02-28T09:02:09.127873Z",
503
+ "shell.execute_reply.started": "2023-02-28T09:02:08.338165Z"
504
+ }
505
+ },
506
+ "outputs": [
507
+ {
508
+ "data": {
509
+ "text/plain": [
510
+ "'certain conditions several generation ,read the notebook and also like notebook'"
511
+ ]
512
+ },
513
+ "execution_count": 14,
514
+ "metadata": {},
515
+ "output_type": "execute_result"
516
+ }
517
+ ],
518
+ "source": [
519
+ "incorrect_text = \"certain conditions several ggenaeration ,read the notebook and alos like notboook\"\n",
520
+ "\n",
521
+ "# Spelling correction by Textblob\n",
522
+ "textBlob = TextBlob(incorrect_text)\n",
523
+ "textBlob.correct().string"
524
+ ]
525
+ },
526
+ {
527
+ "cell_type": "markdown",
528
+ "metadata": {},
529
+ "source": [
530
+ "### - Removing Stopwords\n",
531
+ "for POS - tagging we don't use stopword to remove is,am,are,was,and,but..."
532
+ ]
533
+ },
534
+ {
535
+ "cell_type": "code",
536
+ "execution_count": 15,
537
+ "metadata": {
538
+ "execution": {
539
+ "iopub.execute_input": "2023-02-28T09:02:12.057700Z",
540
+ "iopub.status.busy": "2023-02-28T09:02:12.057305Z",
541
+ "iopub.status.idle": "2023-02-28T09:02:12.070805Z",
542
+ "shell.execute_reply": "2023-02-28T09:02:12.068811Z",
543
+ "shell.execute_reply.started": "2023-02-28T09:02:12.057663Z"
544
+ }
545
+ },
546
+ "outputs": [
547
+ {
548
+ "data": {
549
+ "text/plain": [
550
+ "\"nltk.download('stopwords')\""
551
+ ]
552
+ },
553
+ "execution_count": 15,
554
+ "metadata": {},
555
+ "output_type": "execute_result"
556
+ }
557
+ ],
558
+ "source": [
559
+ "# Import the library and download the stop words:\n",
560
+ "from nltk.corpus import stopwords\n",
561
+ "stp = stopwords.words('english')\n",
562
+ "\n",
563
+ "# Other method if nltk stop words not present\n",
564
+ "'''nltk.download('stopwords')'''"
565
+ ]
566
+ },
567
+ {
568
+ "cell_type": "code",
569
+ "execution_count": 16,
570
+ "metadata": {
571
+ "execution": {
572
+ "iopub.execute_input": "2023-02-28T09:02:14.667306Z",
573
+ "iopub.status.busy": "2023-02-28T09:02:14.666909Z",
574
+ "iopub.status.idle": "2023-02-28T09:02:14.673664Z",
575
+ "shell.execute_reply": "2023-02-28T09:02:14.672527Z",
576
+ "shell.execute_reply.started": "2023-02-28T09:02:14.667267Z"
577
+ }
578
+ },
579
+ "outputs": [],
580
+ "source": [
581
+ "# Define a function to remove stop words from the text:\n",
582
+ "def remove_stopwords(text):\n",
583
+ " new_text = []\n",
584
+ " \n",
585
+ " for word in text.split():\n",
586
+ " if word in stp: # stp = stopwords.words('english')\n",
587
+ " new_text.append('')\n",
588
+ " else:\n",
589
+ " new_text.append(word)\n",
590
+ " \n",
591
+ " x = new_text[:]\n",
592
+ " new_text.clear()\n",
593
+ " return \" \".join(x)"
594
+ ]
595
+ },
596
+ {
597
+ "cell_type": "code",
598
+ "execution_count": 17,
599
+ "metadata": {
600
+ "execution": {
601
+ "iopub.execute_input": "2023-02-28T09:02:16.297289Z",
602
+ "iopub.status.busy": "2023-02-28T09:02:16.296887Z",
603
+ "iopub.status.idle": "2023-02-28T09:02:39.152572Z",
604
+ "shell.execute_reply": "2023-02-28T09:02:39.151496Z",
605
+ "shell.execute_reply.started": "2023-02-28T09:02:16.297251Z"
606
+ }
607
+ },
608
+ "outputs": [],
609
+ "source": [
610
+ "df['review'] = df['review'].apply(remove_stopwords)"
611
+ ]
612
+ },
613
+ {
614
+ "cell_type": "markdown",
615
+ "metadata": {},
616
+ "source": [
617
+ "### - Handling Emoji\n",
618
+ "- **Replace with meaning** -\n",
619
+ "We can remove all emojis from the text using regular expressions\n",
620
+ "- **Remove** -\n",
621
+ "We can replace emojis with a text representation."
622
+ ]
623
+ },
624
+ {
625
+ "cell_type": "code",
626
+ "execution_count": 18,
627
+ "metadata": {
628
+ "execution": {
629
+ "iopub.execute_input": "2023-02-28T09:02:43.119351Z",
630
+ "iopub.status.busy": "2023-02-28T09:02:43.118942Z",
631
+ "iopub.status.idle": "2023-02-28T09:02:43.125800Z",
632
+ "shell.execute_reply": "2023-02-28T09:02:43.124522Z",
633
+ "shell.execute_reply.started": "2023-02-28T09:02:43.119314Z"
634
+ }
635
+ },
636
+ "outputs": [],
637
+ "source": [
638
+ "# Remove by usning Regular expression\n",
639
+ "def remove_emoji(text):\n",
640
+ " emoji_pattern = re.compile(\"[\"\n",
641
+ " u\"\\U0001F600-\\U0001F64F\" # emoticons\n",
642
+ " u\"\\U0001F300-\\U0001F5FF\" # symbols & pictographs\n",
643
+ " u\"\\U0001F680-\\U0001F6FF\" # transport & map symbols\n",
644
+ " u\"\\U0001F1E0-\\U0001F1FF\" # flags (iOS)\n",
645
+ " \"]+\", flags=re.UNICODE)\n",
646
+ " return emoji_pattern.sub(r'', text)"
647
+ ]
648
+ },
649
+ {
650
+ "cell_type": "code",
651
+ "execution_count": 19,
652
+ "metadata": {
653
+ "execution": {
654
+ "iopub.execute_input": "2023-02-28T09:02:45.558806Z",
655
+ "iopub.status.busy": "2023-02-28T09:02:45.557737Z",
656
+ "iopub.status.idle": "2023-02-28T09:02:45.568747Z",
657
+ "shell.execute_reply": "2023-02-28T09:02:45.567353Z",
658
+ "shell.execute_reply.started": "2023-02-28T09:02:45.558761Z"
659
+ }
660
+ },
661
+ "outputs": [
662
+ {
663
+ "data": {
664
+ "text/plain": [
665
+ "'hello, world ,, '"
666
+ ]
667
+ },
668
+ "execution_count": 19,
669
+ "metadata": {},
670
+ "output_type": "execute_result"
671
+ }
672
+ ],
673
+ "source": [
674
+ "emoji_text = \"hello, world 😀,😃,😄 😈 😀\"\n",
675
+ "remove_emoji(emoji_text)"
676
+ ]
677
+ },
678
+ {
679
+ "cell_type": "code",
680
+ "execution_count": 20,
681
+ "metadata": {
682
+ "execution": {
683
+ "iopub.execute_input": "2023-02-28T09:02:48.839342Z",
684
+ "iopub.status.busy": "2023-02-28T09:02:48.838411Z",
685
+ "iopub.status.idle": "2023-02-28T09:02:59.528188Z",
686
+ "shell.execute_reply": "2023-02-28T09:02:59.526961Z",
687
+ "shell.execute_reply.started": "2023-02-28T09:02:48.839294Z"
688
+ }
689
+ },
690
+ "outputs": [
691
+ {
692
+ "name": "stdout",
693
+ "output_type": "stream",
694
+ "text": [
695
+ "Requirement already satisfied: emoji in /opt/conda/lib/python3.7/site-packages (2.2.0)\n",
696
+ "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
697
+ "\u001b[0m"
698
+ ]
699
+ }
700
+ ],
701
+ "source": [
702
+ "!pip install emoji"
703
+ ]
704
+ },
705
+ {
706
+ "cell_type": "code",
707
+ "execution_count": 21,
708
+ "metadata": {
709
+ "execution": {
710
+ "iopub.execute_input": "2023-02-28T09:03:01.798077Z",
711
+ "iopub.status.busy": "2023-02-28T09:03:01.797654Z",
712
+ "iopub.status.idle": "2023-02-28T09:03:01.833902Z",
713
+ "shell.execute_reply": "2023-02-28T09:03:01.832698Z",
714
+ "shell.execute_reply.started": "2023-02-28T09:03:01.798028Z"
715
+ }
716
+ },
717
+ "outputs": [
718
+ {
719
+ "name": "stdout",
720
+ "output_type": "stream",
721
+ "text": [
722
+ "hello, world :grinning_face:,:grinning_face_with_big_eyes:,:grinning_face_with_smiling_eyes: :smiling_face_with_horns: :grinning_face:\n"
723
+ ]
724
+ }
725
+ ],
726
+ "source": [
727
+ "# Replacing emoji to text\n",
728
+ "import emoji\n",
729
+ "\n",
730
+ "print(emoji.demojize(\"hello, world 😀,😃,😄 😈 😀\"))"
731
+ ]
732
+ },
733
+ {
734
+ "cell_type": "markdown",
735
+ "metadata": {},
736
+ "source": [
737
+ "### - Tokenizations :\n",
738
+ "**- Word Tokenization**\n",
739
+ "\n",
740
+ "**- Sentence Tokenization**\n",
741
+ "\n",
742
+ "**White space tokenization:** This method splits a text into tokens based on the white space characters (e.g., spaces, tabs, newlines) between them. This is the simplest form of tokenization and can be implemented using the split() function in Python.\n",
743
+ "\n",
744
+ "**Punctuation-based tokenization:** This method splits a text into tokens based on the punctuation marks between them. This method is more complex than white space tokenization and can be implemented using regular expressions or the nltk library in Python.\n",
745
+ "\n",
746
+ "**Word-based tokenization:** This method splits a text into tokens based on the words between them. This method is more complex than white space tokenization and requires a language model that can identify the boundaries between words. The nltk library provides several pre-trained models for word-based tokenization, including the punkt model."
747
+ ]
748
+ },
749
+ {
750
+ "cell_type": "code",
751
+ "execution_count": 22,
752
+ "metadata": {
753
+ "execution": {
754
+ "iopub.execute_input": "2023-02-28T09:03:07.908166Z",
755
+ "iopub.status.busy": "2023-02-28T09:03:07.907155Z",
756
+ "iopub.status.idle": "2023-02-28T09:03:07.913903Z",
757
+ "shell.execute_reply": "2023-02-28T09:03:07.912592Z",
758
+ "shell.execute_reply.started": "2023-02-28T09:03:07.908110Z"
759
+ }
760
+ },
761
+ "outputs": [],
762
+ "source": [
763
+ "sent_1 = \"This method splits by sentences. This tokenization implemented\"\n",
764
+ "sent_2 = \"This method splits by word.This tokenization implemented\"\n",
765
+ "\n",
766
+ "# By Using NLTK\n",
767
+ "from nltk.tokenize import word_tokenize ,sent_tokenize"
768
+ ]
769
+ },
770
+ {
771
+ "cell_type": "code",
772
+ "execution_count": 23,
773
+ "metadata": {
774
+ "execution": {
775
+ "iopub.execute_input": "2023-02-28T09:03:10.058110Z",
776
+ "iopub.status.busy": "2023-02-28T09:03:10.057093Z",
777
+ "iopub.status.idle": "2023-02-28T09:03:10.079265Z",
778
+ "shell.execute_reply": "2023-02-28T09:03:10.078026Z",
779
+ "shell.execute_reply.started": "2023-02-28T09:03:10.058047Z"
780
+ }
781
+ },
782
+ "outputs": [
783
+ {
784
+ "name": "stdout",
785
+ "output_type": "stream",
786
+ "text": [
787
+ "sentence_tokenize - ['This method splits by sentences.', 'This tokenization implemented']\n",
788
+ "word_tokenize - ['This', 'method', 'splits', 'by', 'word.This', 'tokenization', 'implemented']\n"
789
+ ]
790
+ }
791
+ ],
792
+ "source": [
793
+ "print('sentence_tokenize -',sent_tokenize(sent_1))\n",
794
+ "print('word_tokenize -',word_tokenize(sent_2))"
795
+ ]
796
+ },
797
+ {
798
+ "cell_type": "code",
799
+ "execution_count": 24,
800
+ "metadata": {
801
+ "execution": {
802
+ "iopub.execute_input": "2023-02-28T09:03:12.943338Z",
803
+ "iopub.status.busy": "2023-02-28T09:03:12.942087Z",
804
+ "iopub.status.idle": "2023-02-28T09:03:36.465661Z",
805
+ "shell.execute_reply": "2023-02-28T09:03:36.464382Z",
806
+ "shell.execute_reply.started": "2023-02-28T09:03:12.943284Z"
807
+ }
808
+ },
809
+ "outputs": [
810
+ {
811
+ "name": "stdout",
812
+ "output_type": "stream",
813
+ "text": [
814
+ "sent_1 tokenize [This, method, splits, by, sentences, ., This, tokenization, implemented]\n",
815
+ "sent_2 tokenize [This, method, splits, by, word, ., This, tokenization, implemented]\n"
816
+ ]
817
+ }
818
+ ],
819
+ "source": [
820
+ "# By Using Spacy\n",
821
+ "import spacy\n",
822
+ "nlp = spacy.load('en_core_web_sm')\n",
823
+ "\n",
824
+ "doc1 = nlp(sent_1)\n",
825
+ "doc2 = nlp(sent_2)\n",
826
+ "\n",
827
+ "sent1 = []\n",
828
+ "sent2 = []\n",
829
+ "for token in doc1:\n",
830
+ " sent1.append(token)\n",
831
+ "for token in doc2:\n",
832
+ " sent2.append(token)\n",
833
+ "print('sent_1 tokenize',sent1)\n",
834
+ "print('sent_2 tokenize',sent2)"
835
+ ]
836
+ },
837
+ {
838
+ "cell_type": "code",
839
+ "execution_count": 25,
840
+ "metadata": {
841
+ "execution": {
842
+ "iopub.execute_input": "2023-02-28T09:03:36.468767Z",
843
+ "iopub.status.busy": "2023-02-28T09:03:36.467757Z",
844
+ "iopub.status.idle": "2023-02-28T09:04:05.529030Z",
845
+ "shell.execute_reply": "2023-02-28T09:04:05.527967Z",
846
+ "shell.execute_reply.started": "2023-02-28T09:03:36.468723Z"
847
+ }
848
+ },
849
+ "outputs": [],
850
+ "source": [
851
+ "# Apply nltk word_tokenize in imdb data\n",
852
+ "from nltk.tokenize import word_tokenize\n",
853
+ "def wrd_token(text):\n",
854
+ " return word_tokenize(text)\n",
855
+ "df['review'] = df['review'].apply(wrd_token)"
856
+ ]
857
+ },
858
+ {
859
+ "cell_type": "markdown",
860
+ "metadata": {},
861
+ "source": [
862
+ "### - Stemming :(It is slow in processing)\n"
863
+ ]
864
+ },
865
+ {
866
+ "cell_type": "code",
867
+ "execution_count": 28,
868
+ "metadata": {
869
+ "execution": {
870
+ "iopub.execute_input": "2023-02-28T09:04:35.737577Z",
871
+ "iopub.status.busy": "2023-02-28T09:04:35.736859Z",
872
+ "iopub.status.idle": "2023-02-28T09:04:35.743182Z",
873
+ "shell.execute_reply": "2023-02-28T09:04:35.741453Z",
874
+ "shell.execute_reply.started": "2023-02-28T09:04:35.737534Z"
875
+ }
876
+ },
877
+ "outputs": [],
878
+ "source": [
879
+ "from nltk.stem.porter import PorterStemmer\n",
880
+ "ps = PorterStemmer()"
881
+ ]
882
+ },
883
+ {
884
+ "cell_type": "code",
885
+ "execution_count": 29,
886
+ "metadata": {
887
+ "execution": {
888
+ "iopub.execute_input": "2023-02-28T09:04:46.312604Z",
889
+ "iopub.status.busy": "2023-02-28T09:04:46.311973Z",
890
+ "iopub.status.idle": "2023-02-28T09:07:17.076444Z",
891
+ "shell.execute_reply": "2023-02-28T09:07:17.075197Z",
892
+ "shell.execute_reply.started": "2023-02-28T09:04:46.312561Z"
893
+ }
894
+ },
895
+ "outputs": [
896
+ {
897
+ "data": {
898
+ "text/plain": [
899
+ "0 one review mention watch 1 oz episod youll hoo...\n",
900
+ "1 wonder littl product film techniqu unassum old...\n",
901
+ "2 thought wonder way spend time hot summer weeke...\n",
902
+ "3 basic there famili littl boy jake think there ...\n",
903
+ "4 petter mattei love time money visual stun film...\n",
904
+ " ... \n",
905
+ "49995 thought movi right good job wasnt creativ orig...\n",
906
+ "49996 bad plot bad dialogu bad act idiot direct anno...\n",
907
+ "49997 cathol taught parochi elementari school nun ta...\n",
908
+ "49998 im go disagre previou comment side maltin one ...\n",
909
+ "49999 one expect star trek movi high art fan expect ...\n",
910
+ "Name: review, Length: 50000, dtype: object"
911
+ ]
912
+ },
913
+ "execution_count": 29,
914
+ "metadata": {},
915
+ "output_type": "execute_result"
916
+ }
917
+ ],
918
+ "source": [
919
+ "# Function for applying stemming function\n",
920
+ "def stem_words(text):\n",
921
+ " return \" \".join([ps.stem(word) for word in text])\n",
922
+ "\n",
923
+ "df['review'].apply(stem_words)"
924
+ ]
925
+ },
926
+ {
927
+ "cell_type": "markdown",
928
+ "metadata": {},
929
+ "source": [
930
+ "### - Lemmatization :\n"
931
+ ]
932
+ },
933
+ {
934
+ "cell_type": "code",
935
+ "execution_count": 35,
936
+ "metadata": {
937
+ "execution": {
938
+ "iopub.execute_input": "2023-02-28T09:12:05.953498Z",
939
+ "iopub.status.busy": "2023-02-28T09:12:05.952776Z",
940
+ "iopub.status.idle": "2023-02-28T09:12:12.682133Z",
941
+ "shell.execute_reply": "2023-02-28T09:12:12.679291Z",
942
+ "shell.execute_reply.started": "2023-02-28T09:12:05.953435Z"
943
+ }
944
+ },
945
+ "outputs": [
946
+ {
947
+ "name": "stdout",
948
+ "output_type": "stream",
949
+ "text": [
950
+ "NLTK Downloader\n",
951
+ "---------------------------------------------------------------------------\n",
952
+ " d) Download l) List u) Update c) Config h) Help q) Quit\n",
953
+ "---------------------------------------------------------------------------\n"
954
+ ]
955
+ },
956
+ {
957
+ "ename": "KeyboardInterrupt",
958
+ "evalue": "Interrupted by user",
959
+ "output_type": "error",
960
+ "traceback": [
961
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
962
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
963
+ "\u001b[0;32m/tmp/ipykernel_308/4212150469.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnltk\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mnltk\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstem\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mWordNetLemmatizer\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mnltk\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdownload\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0mlemmatizer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mWordNetLemmatizer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
964
+ "\u001b[0;32m/opt/conda/lib/python3.7/site-packages/nltk/downloader.py\u001b[0m in \u001b[0;36mdownload\u001b[0;34m(self, info_or_id, download_dir, quiet, force, prefix, halt_on_error, raise_on_error)\u001b[0m\n\u001b[1;32m 659\u001b[0m \u001b[0;31m# function should make a new copy of self to use?\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 660\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdownload_dir\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_download_dir\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdownload_dir\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 661\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_interactive_download\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 662\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 663\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
965
+ "\u001b[0;32m/opt/conda/lib/python3.7/site-packages/nltk/downloader.py\u001b[0m in \u001b[0;36m_interactive_download\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 982\u001b[0m \u001b[0mDownloaderGUI\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmainloop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 983\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mTclError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 984\u001b[0;31m \u001b[0mDownloaderShell\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 985\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 986\u001b[0m \u001b[0mDownloaderShell\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
966
+ "\u001b[0;32m/opt/conda/lib/python3.7/site-packages/nltk/downloader.py\u001b[0m in \u001b[0;36mrun\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1004\u001b[0m self._simple_interactive_menu(\n\u001b[1;32m 1005\u001b[0m 'd) Download', 'l) List', ' u) Update', 'c) Config', 'h) Help', 'q) Quit')\n\u001b[0;32m-> 1006\u001b[0;31m \u001b[0muser_input\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0minput\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Downloader> '\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstrip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1007\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0muser_input\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m \u001b[0;32mcontinue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1008\u001b[0m \u001b[0mcommand\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0muser_input\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
967
+ "\u001b[0;32m/opt/conda/lib/python3.7/site-packages/ipykernel/kernelbase.py\u001b[0m in \u001b[0;36mraw_input\u001b[0;34m(self, prompt)\u001b[0m\n\u001b[1;32m 1179\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_parent_ident\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"shell\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1180\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_parent\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"shell\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1181\u001b[0;31m \u001b[0mpassword\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1182\u001b[0m )\n\u001b[1;32m 1183\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
968
+ "\u001b[0;32m/opt/conda/lib/python3.7/site-packages/ipykernel/kernelbase.py\u001b[0m in \u001b[0;36m_input_request\u001b[0;34m(self, prompt, ident, parent, password)\u001b[0m\n\u001b[1;32m 1217\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1218\u001b[0m \u001b[0;31m# re-raise KeyboardInterrupt, to truncate traceback\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1219\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyboardInterrupt\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Interrupted by user\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1220\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1221\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlog\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwarning\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Invalid Message:\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexc_info\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
969
+ "\u001b[0;31mKeyboardInterrupt\u001b[0m: Interrupted by user"
970
+ ]
971
+ }
972
+ ],
973
+ "source": [
974
+ "import nltk\n",
975
+ "from nltk.stem import WordNetLemmatizer\n",
976
+ "nltk.download() \n",
977
+ "lemmatizer = WordNetLemmatizer()\n",
978
+ "\n",
979
+ "def lemma_words(text):\n",
980
+ " return \" \".join([lemmatizer.lemmatize(word) for word in text])"
981
+ ]
982
+ },
983
+ {
984
+ "cell_type": "code",
985
+ "execution_count": 36,
986
+ "metadata": {
987
+ "execution": {
988
+ "iopub.execute_input": "2023-02-28T09:12:39.848502Z",
989
+ "iopub.status.busy": "2023-02-28T09:12:39.847845Z",
990
+ "iopub.status.idle": "2023-02-28T09:15:17.653995Z",
991
+ "shell.execute_reply": "2023-02-28T09:15:17.652811Z",
992
+ "shell.execute_reply.started": "2023-02-28T09:12:39.848457Z"
993
+ }
994
+ },
995
+ "outputs": [],
996
+ "source": [
997
+ "df['lemma_review'] = df['review'].apply(stem_words)"
998
+ ]
999
+ },
1000
+ {
1001
+ "cell_type": "code",
1002
+ "execution_count": 32,
1003
+ "metadata": {
1004
+ "execution": {
1005
+ "iopub.execute_input": "2023-02-28T09:09:25.548239Z",
1006
+ "iopub.status.busy": "2023-02-28T09:09:25.547782Z",
1007
+ "iopub.status.idle": "2023-02-28T09:09:25.595610Z",
1008
+ "shell.execute_reply": "2023-02-28T09:09:25.594356Z",
1009
+ "shell.execute_reply.started": "2023-02-28T09:09:25.548199Z"
1010
+ }
1011
+ },
1012
+ "outputs": [
1013
+ {
1014
+ "name": "stdout",
1015
+ "output_type": "stream",
1016
+ "text": [
1017
+ "No. of word in corpus - 599977\n",
1018
+ "No. of unique word in corpus - 55158\n"
1019
+ ]
1020
+ }
1021
+ ],
1022
+ "source": [
1023
+ "# Total number of words in corpus and number of unique word.\n",
1024
+ "merge_list = []\n",
1025
+ "for row in df['review'][0:5000]:\n",
1026
+ " merge_list.extend(row)\n",
1027
+ "print('No. of word in corpus - ',len(merge_list))\n",
1028
+ "print('No. of unique word in corpus - ',len(set(merge_list)))"
1029
+ ]
1030
+ },
1031
+ {
1032
+ "cell_type": "markdown",
1033
+ "metadata": {},
1034
+ "source": [
1035
+ "## 2. Text Representations Or Text Vectorization:\n",
1036
+ "\n",
1037
+ "### - Bag of word (Text classification)\n",
1038
+ "\n"
1039
+ ]
1040
+ },
1041
+ {
1042
+ "cell_type": "code",
1043
+ "execution_count": 30,
1044
+ "metadata": {
1045
+ "execution": {
1046
+ "iopub.execute_input": "2023-02-28T08:59:46.519000Z",
1047
+ "iopub.status.busy": "2023-02-28T08:59:46.516506Z",
1048
+ "iopub.status.idle": "2023-02-28T08:59:51.295200Z",
1049
+ "shell.execute_reply": "2023-02-28T08:59:51.294131Z",
1050
+ "shell.execute_reply.started": "2023-02-28T08:59:46.518957Z"
1051
+ }
1052
+ },
1053
+ "outputs": [],
1054
+ "source": [
1055
+ "from sklearn.feature_extraction.text import CountVectorizer\n",
1056
+ "cv = CountVectorizer()\n",
1057
+ "bow = cv.fit_transform(df['lemma_review'])"
1058
+ ]
1059
+ },
1060
+ {
1061
+ "cell_type": "code",
1062
+ "execution_count": null,
1063
+ "metadata": {
1064
+ "execution": {
1065
+ "iopub.execute_input": "2023-02-28T08:59:51.301302Z",
1066
+ "iopub.status.busy": "2023-02-28T08:59:51.300748Z"
1067
+ }
1068
+ },
1069
+ "outputs": [],
1070
+ "source": [
1071
+ "bow.toarray()"
1072
+ ]
1073
+ },
1074
+ {
1075
+ "cell_type": "markdown",
1076
+ "metadata": {},
1077
+ "source": [
1078
+ "### - N-Grams or Bag of Ngrams\n",
1079
+ "\n",
1080
+ "Dimension increase with increase in ngrams, It slows down the Algorithim and out of vocabulary ignored."
1081
+ ]
1082
+ },
1083
+ {
1084
+ "cell_type": "code",
1085
+ "execution_count": 1,
1086
+ "metadata": {
1087
+ "execution": {
1088
+ "iopub.execute_input": "2023-02-28T09:00:17.147997Z",
1089
+ "iopub.status.busy": "2023-02-28T09:00:17.147340Z",
1090
+ "iopub.status.idle": "2023-02-28T09:00:18.009694Z",
1091
+ "shell.execute_reply": "2023-02-28T09:00:18.008034Z",
1092
+ "shell.execute_reply.started": "2023-02-28T09:00:17.147955Z"
1093
+ }
1094
+ },
1095
+ "outputs": [
1096
+ {
1097
+ "ename": "NameError",
1098
+ "evalue": "name 'df' is not defined",
1099
+ "output_type": "error",
1100
+ "traceback": [
1101
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
1102
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
1103
+ "\u001b[0;32m/tmp/ipykernel_308/285669394.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0msklearn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfeature_extraction\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtext\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mCountVectorizer\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mcv_1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mCountVectorizer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mngram_range\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mbow2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcv_1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfit_transform\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'lemma_review'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
1104
+ "\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
1105
+ ]
1106
+ }
1107
+ ],
1108
+ "source": [
1109
+ "from sklearn.feature_extraction.text import CountVectorizer\n",
1110
+ "cv_1 = CountVectorizer(ngram_range=(10,10))\n",
1111
+ "bow2 = cv_1.fit_transform(df['lemma_review'])"
1112
+ ]
1113
+ },
1114
+ {
1115
+ "cell_type": "code",
1116
+ "execution_count": null,
1117
+ "metadata": {},
1118
+ "outputs": [],
1119
+ "source": [
1120
+ "bow2.toarray()"
1121
+ ]
1122
+ },
1123
+ {
1124
+ "cell_type": "markdown",
1125
+ "metadata": {},
1126
+ "source": [
1127
+ "### - Tf - idf (Term frequency and Inverse Document frequency)\n",
1128
+ "\n",
1129
+ "There sparcity present and out of vocabulary ignore, Dimension large if vocabulary large and symantic relationship not capture."
1130
+ ]
1131
+ },
1132
+ {
1133
+ "cell_type": "code",
1134
+ "execution_count": 2,
1135
+ "metadata": {
1136
+ "execution": {
1137
+ "iopub.execute_input": "2023-02-28T09:17:00.313046Z",
1138
+ "iopub.status.busy": "2023-02-28T09:17:00.312563Z",
1139
+ "iopub.status.idle": "2023-02-28T09:17:01.216547Z",
1140
+ "shell.execute_reply": "2023-02-28T09:17:01.214914Z",
1141
+ "shell.execute_reply.started": "2023-02-28T09:17:00.313002Z"
1142
+ }
1143
+ },
1144
+ "outputs": [
1145
+ {
1146
+ "ename": "NameError",
1147
+ "evalue": "name 'df' is not defined",
1148
+ "output_type": "error",
1149
+ "traceback": [
1150
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
1151
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
1152
+ "\u001b[0;32m/tmp/ipykernel_1018/587138577.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0msklearn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfeature_extraction\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtext\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mTfidfVectorizer\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mtfidf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mTfidfVectorizer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mtf_idf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtfidf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfit_transform\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'lemma_review'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
1153
+ "\u001b[0;31mNameError\u001b[0m: name 'df' is not defined"
1154
+ ]
1155
+ }
1156
+ ],
1157
+ "source": [
1158
+ "from sklearn.feature_extraction.text import TfidfVectorizer\n",
1159
+ "tfidf = TfidfVectorizer()\n",
1160
+ "tf_idf = tfidf.fit_transform(df['lemma_review'])"
1161
+ ]
1162
+ },
1163
+ {
1164
+ "cell_type": "code",
1165
+ "execution_count": 1,
1166
+ "metadata": {
1167
+ "execution": {
1168
+ "iopub.execute_input": "2023-02-28T09:16:54.789060Z",
1169
+ "iopub.status.busy": "2023-02-28T09:16:54.787898Z",
1170
+ "iopub.status.idle": "2023-02-28T09:16:54.868566Z",
1171
+ "shell.execute_reply": "2023-02-28T09:16:54.866662Z",
1172
+ "shell.execute_reply.started": "2023-02-28T09:16:54.789007Z"
1173
+ }
1174
+ },
1175
+ "outputs": [
1176
+ {
1177
+ "ename": "NameError",
1178
+ "evalue": "name 'tf_idf' is not defined",
1179
+ "output_type": "error",
1180
+ "traceback": [
1181
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
1182
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
1183
+ "\u001b[0;32m/tmp/ipykernel_1018/1279619201.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtf_idf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoarray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
1184
+ "\u001b[0;31mNameError\u001b[0m: name 'tf_idf' is not defined"
1185
+ ]
1186
+ }
1187
+ ],
1188
+ "source": [
1189
+ "tf_idf.toarray()"
1190
+ ]
1191
+ },
1192
+ {
1193
+ "cell_type": "code",
1194
+ "execution_count": null,
1195
+ "metadata": {},
1196
+ "outputs": [],
1197
+ "source": []
1198
+ },
1199
+ {
1200
+ "cell_type": "code",
1201
+ "execution_count": null,
1202
+ "metadata": {},
1203
+ "outputs": [],
1204
+ "source": []
1205
+ },
1206
+ {
1207
+ "cell_type": "code",
1208
+ "execution_count": null,
1209
+ "metadata": {},
1210
+ "outputs": [],
1211
+ "source": []
1212
+ },
1213
+ {
1214
+ "cell_type": "code",
1215
+ "execution_count": null,
1216
+ "metadata": {},
1217
+ "outputs": [],
1218
+ "source": []
1219
+ },
1220
+ {
1221
+ "cell_type": "code",
1222
+ "execution_count": null,
1223
+ "metadata": {},
1224
+ "outputs": [],
1225
+ "source": [
1226
+ "df['review'][0]"
1227
+ ]
1228
+ },
1229
+ {
1230
+ "cell_type": "code",
1231
+ "execution_count": null,
1232
+ "metadata": {},
1233
+ "outputs": [],
1234
+ "source": []
1235
+ }
1236
+ ],
1237
+ "metadata": {
1238
+ "kernelspec": {
1239
+ "display_name": "Python 3",
1240
+ "language": "python",
1241
+ "name": "python3"
1242
+ },
1243
+ "language_info": {
1244
+ "codemirror_mode": {
1245
+ "name": "ipython",
1246
+ "version": 3
1247
+ },
1248
+ "file_extension": ".py",
1249
+ "mimetype": "text/x-python",
1250
+ "name": "python",
1251
+ "nbconvert_exporter": "python",
1252
+ "pygments_lexer": "ipython3",
1253
+ "version": "3.10.12"
1254
+ }
1255
+ },
1256
+ "nbformat": 4,
1257
+ "nbformat_minor": 4
1258
+ }
benchmark/NBspecific_1/NBspecific_1_fixed.ipynb ADDED
@@ -0,0 +1,1123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {
7
+ "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
8
+ "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
9
+ "execution": {
10
+ "iopub.execute_input": "2023-02-28T09:01:35.199038Z",
11
+ "iopub.status.busy": "2023-02-28T09:01:35.198153Z",
12
+ "iopub.status.idle": "2023-02-28T09:01:35.214562Z",
13
+ "shell.execute_reply": "2023-02-28T09:01:35.213234Z",
14
+ "shell.execute_reply.started": "2023-02-28T09:01:35.198993Z"
15
+ }
16
+ },
17
+ "outputs": [
18
+ {
19
+ "name": "stdout",
20
+ "output_type": "stream",
21
+ "text": [
22
+ "data/IMDB Dataset.csv\n"
23
+ ]
24
+ }
25
+ ],
26
+ "source": [
27
+ "# This Python 3 environment comes with many helpful analytics libraries installed\n",
28
+ "# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n",
29
+ "# For example, here's several helpful packages to load\n",
30
+ "\n",
31
+ "import numpy as np # linear algebra\n",
32
+ "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
33
+ "\n",
34
+ "# Input data files are available in the read-only \"../input/\" directory\n",
35
+ "# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n",
36
+ "\n",
37
+ "import os\n",
38
+ "for dirname, _, filenames in os.walk('data'):\n",
39
+ " for filename in filenames:\n",
40
+ " print(os.path.join(dirname, filename))\n",
41
+ "\n",
42
+ "# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n",
43
+ "# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session"
44
+ ]
45
+ },
46
+ {
47
+ "cell_type": "code",
48
+ "execution_count": 2,
49
+ "metadata": {
50
+ "execution": {
51
+ "iopub.execute_input": "2023-02-28T09:01:37.498012Z",
52
+ "iopub.status.busy": "2023-02-28T09:01:37.497070Z",
53
+ "iopub.status.idle": "2023-02-28T09:01:37.502150Z",
54
+ "shell.execute_reply": "2023-02-28T09:01:37.501011Z",
55
+ "shell.execute_reply.started": "2023-02-28T09:01:37.497972Z"
56
+ }
57
+ },
58
+ "outputs": [],
59
+ "source": [
60
+ "import re # Regular expression"
61
+ ]
62
+ },
63
+ {
64
+ "cell_type": "markdown",
65
+ "metadata": {},
66
+ "source": [
67
+ "## 1. Data Accqasation\n",
68
+ "This notebook will do basic IMDB reviews sentiment analysis. As show in below image, we will be performing few text cleaning and model building techniques. The flow of the notebook."
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": 4,
74
+ "metadata": {
75
+ "execution": {
76
+ "iopub.execute_input": "2023-02-28T09:01:40.837603Z",
77
+ "iopub.status.busy": "2023-02-28T09:01:40.836859Z",
78
+ "iopub.status.idle": "2023-02-28T09:01:42.179878Z",
79
+ "shell.execute_reply": "2023-02-28T09:01:42.178776Z",
80
+ "shell.execute_reply.started": "2023-02-28T09:01:40.837558Z"
81
+ }
82
+ },
83
+ "outputs": [
84
+ {
85
+ "data": {
86
+ "text/html": [
87
+ "<div>\n",
88
+ "<style scoped>\n",
89
+ " .dataframe tbody tr th:only-of-type {\n",
90
+ " vertical-align: middle;\n",
91
+ " }\n",
92
+ "\n",
93
+ " .dataframe tbody tr th {\n",
94
+ " vertical-align: top;\n",
95
+ " }\n",
96
+ "\n",
97
+ " .dataframe thead th {\n",
98
+ " text-align: right;\n",
99
+ " }\n",
100
+ "</style>\n",
101
+ "<table border=\"1\" class=\"dataframe\">\n",
102
+ " <thead>\n",
103
+ " <tr style=\"text-align: right;\">\n",
104
+ " <th></th>\n",
105
+ " <th>review</th>\n",
106
+ " <th>sentiment</th>\n",
107
+ " </tr>\n",
108
+ " </thead>\n",
109
+ " <tbody>\n",
110
+ " <tr>\n",
111
+ " <th>0</th>\n",
112
+ " <td>One of the other reviewers has mentioned that ...</td>\n",
113
+ " <td>positive</td>\n",
114
+ " </tr>\n",
115
+ " <tr>\n",
116
+ " <th>1</th>\n",
117
+ " <td>A wonderful little production. &lt;br /&gt;&lt;br /&gt;The...</td>\n",
118
+ " <td>positive</td>\n",
119
+ " </tr>\n",
120
+ " <tr>\n",
121
+ " <th>2</th>\n",
122
+ " <td>I thought this was a wonderful way to spend ti...</td>\n",
123
+ " <td>positive</td>\n",
124
+ " </tr>\n",
125
+ " <tr>\n",
126
+ " <th>3</th>\n",
127
+ " <td>Basically there's a family where a little boy ...</td>\n",
128
+ " <td>negative</td>\n",
129
+ " </tr>\n",
130
+ " <tr>\n",
131
+ " <th>4</th>\n",
132
+ " <td>Petter Mattei's \"Love in the Time of Money\" is...</td>\n",
133
+ " <td>positive</td>\n",
134
+ " </tr>\n",
135
+ " </tbody>\n",
136
+ "</table>\n",
137
+ "</div>"
138
+ ],
139
+ "text/plain": [
140
+ " review sentiment\n",
141
+ "0 One of the other reviewers has mentioned that ... positive\n",
142
+ "1 A wonderful little production. <br /><br />The... positive\n",
143
+ "2 I thought this was a wonderful way to spend ti... positive\n",
144
+ "3 Basically there's a family where a little boy ... negative\n",
145
+ "4 Petter Mattei's \"Love in the Time of Money\" is... positive"
146
+ ]
147
+ },
148
+ "execution_count": 4,
149
+ "metadata": {},
150
+ "output_type": "execute_result"
151
+ }
152
+ ],
153
+ "source": [
154
+ "df = pd.read_csv(\"data/IMDB Dataset.csv\")\n",
155
+ "df.head()"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "markdown",
160
+ "metadata": {},
161
+ "source": [
162
+ "## 1. Text Preprocessing\n",
163
+ "- Lower casing\n",
164
+ "- Remove HTML Tags\n",
165
+ "- Remove Punctuations\n",
166
+ "- Remove Stopwords\n",
167
+ "- Steamming and Lemmatization\n",
168
+ "- Observation"
169
+ ]
170
+ },
171
+ {
172
+ "cell_type": "code",
173
+ "execution_count": null,
174
+ "metadata": {
175
+ "execution": {
176
+ "iopub.execute_input": "2023-02-28T09:01:44.623338Z",
177
+ "iopub.status.busy": "2023-02-28T09:01:44.622496Z",
178
+ "iopub.status.idle": "2023-02-28T09:01:44.635713Z",
179
+ "shell.execute_reply": "2023-02-28T09:01:44.634598Z",
180
+ "shell.execute_reply.started": "2023-02-28T09:01:44.623294Z"
181
+ }
182
+ },
183
+ "outputs": [],
184
+ "source": [
185
+ "df['review']"
186
+ ]
187
+ },
188
+ {
189
+ "cell_type": "markdown",
190
+ "metadata": {},
191
+ "source": [
192
+ "### - Lowercasing all the Data"
193
+ ]
194
+ },
195
+ {
196
+ "cell_type": "code",
197
+ "execution_count": 5,
198
+ "metadata": {
199
+ "execution": {
200
+ "iopub.execute_input": "2023-02-28T09:01:46.978097Z",
201
+ "iopub.status.busy": "2023-02-28T09:01:46.977348Z",
202
+ "iopub.status.idle": "2023-02-28T09:01:47.121675Z",
203
+ "shell.execute_reply": "2023-02-28T09:01:47.120539Z",
204
+ "shell.execute_reply.started": "2023-02-28T09:01:46.978052Z"
205
+ }
206
+ },
207
+ "outputs": [],
208
+ "source": [
209
+ "# Apply all the preprocessing techniques\n",
210
+ "\n",
211
+ "# Convert all the text to lowercase\n",
212
+ "df['review'] = df['review'].str.lower()"
213
+ ]
214
+ },
215
+ {
216
+ "cell_type": "markdown",
217
+ "metadata": {},
218
+ "source": [
219
+ "### - Removeing HTML tags from Data"
220
+ ]
221
+ },
222
+ {
223
+ "cell_type": "code",
224
+ "execution_count": 6,
225
+ "metadata": {
226
+ "execution": {
227
+ "iopub.execute_input": "2023-02-28T09:01:49.177674Z",
228
+ "iopub.status.busy": "2023-02-28T09:01:49.176927Z",
229
+ "iopub.status.idle": "2023-02-28T09:01:49.395393Z",
230
+ "shell.execute_reply": "2023-02-28T09:01:49.394319Z",
231
+ "shell.execute_reply.started": "2023-02-28T09:01:49.177633Z"
232
+ }
233
+ },
234
+ "outputs": [],
235
+ "source": [
236
+ "# Removing HTML Tags\n",
237
+ "def remove_html_tags(text):\n",
238
+ " clean = re.compile('<.*?>')\n",
239
+ " return re.sub(clean, '', text)\n",
240
+ "\n",
241
+ "df['review'] = df['review'].apply(remove_html_tags)"
242
+ ]
243
+ },
244
+ {
245
+ "cell_type": "markdown",
246
+ "metadata": {},
247
+ "source": [
248
+ "### - Removing URLs from Texts"
249
+ ]
250
+ },
251
+ {
252
+ "cell_type": "code",
253
+ "execution_count": 7,
254
+ "metadata": {
255
+ "execution": {
256
+ "iopub.execute_input": "2023-02-28T09:01:52.159195Z",
257
+ "iopub.status.busy": "2023-02-28T09:01:52.158402Z",
258
+ "iopub.status.idle": "2023-02-28T09:01:52.674649Z",
259
+ "shell.execute_reply": "2023-02-28T09:01:52.673548Z",
260
+ "shell.execute_reply.started": "2023-02-28T09:01:52.159151Z"
261
+ }
262
+ },
263
+ "outputs": [],
264
+ "source": [
265
+ "# Removing URLs from Texts\n",
266
+ "def remove_urls(text):\n",
267
+ " clean = re.compile(r'http\\S+|www.\\S+')\n",
268
+ " return re.sub(clean, '', text)\n",
269
+ "\n",
270
+ "df['review'] = df['review'].apply(remove_urls)"
271
+ ]
272
+ },
273
+ {
274
+ "cell_type": "markdown",
275
+ "metadata": {},
276
+ "source": [
277
+ "### - Removing Punctuations from Data"
278
+ ]
279
+ },
280
+ {
281
+ "cell_type": "code",
282
+ "execution_count": 8,
283
+ "metadata": {
284
+ "execution": {
285
+ "iopub.execute_input": "2023-02-28T09:01:54.689274Z",
286
+ "iopub.status.busy": "2023-02-28T09:01:54.687886Z",
287
+ "iopub.status.idle": "2023-02-28T09:01:55.752957Z",
288
+ "shell.execute_reply": "2023-02-28T09:01:55.751887Z",
289
+ "shell.execute_reply.started": "2023-02-28T09:01:54.689212Z"
290
+ }
291
+ },
292
+ "outputs": [],
293
+ "source": [
294
+ "import string\n",
295
+ "exclude = string.punctuation\n",
296
+ "\n",
297
+ "# Remove punctuation \n",
298
+ "def remove_punc(text):\n",
299
+ " return text.translate(str.maketrans('','',exclude))\n",
300
+ "\n",
301
+ "df['review'] = df['review'].apply(remove_punc) "
302
+ ]
303
+ },
304
+ {
305
+ "cell_type": "markdown",
306
+ "metadata": {},
307
+ "source": [
308
+ "### - Chart word treatments(short form sms_slangs)"
309
+ ]
310
+ },
311
+ {
312
+ "cell_type": "code",
313
+ "execution_count": null,
314
+ "metadata": {
315
+ "execution": {
316
+ "iopub.execute_input": "2023-02-28T09:01:58.088137Z",
317
+ "iopub.status.busy": "2023-02-28T09:01:58.087588Z",
318
+ "iopub.status.idle": "2023-02-28T09:01:58.102145Z",
319
+ "shell.execute_reply": "2023-02-28T09:01:58.100570Z",
320
+ "shell.execute_reply.started": "2023-02-28T09:01:58.088094Z"
321
+ }
322
+ },
323
+ "outputs": [],
324
+ "source": [
325
+ "chart_words = {\"AFAIK\":\"As Far As I Know\",\n",
326
+ "'AFK':'Away From Keyboard',\n",
327
+ "'ASAP':'As Soon As Possible',\n",
328
+ "'ATK':'At The Keyboard',\n",
329
+ "'ATM':'At The Moment',\n",
330
+ "'A3':'Anytime, Anywhere, Anyplace',\n",
331
+ "'BAK':'Back At Keyboard',\n",
332
+ "'BBL':'Be Back Later',\n",
333
+ "'BBS':'Be Back Soon',\n",
334
+ "'BFN':'Bye For Now',\n",
335
+ "'B4N':'Bye For Now',\n",
336
+ "'BRB':'Be Right Back',\n",
337
+ "'BRT':'Be Right There',\n",
338
+ "'BTW':'By The Way',\n",
339
+ "'B4':'Before',\n",
340
+ "'B4N':'Bye For Now',\n",
341
+ "'CU':'See You',\n",
342
+ "'CUL8R':'See You Later',\n",
343
+ "'CYA':'See You',\n",
344
+ "'FAQ':'Frequently Asked Questions',\n",
345
+ "'FC':'Fingers Crossed',\n",
346
+ "\"FWIW\":\"For What It's Worth\",\n",
347
+ "\"FYI\":\"For Your Information\",\n",
348
+ "\"GAL\":\"Get A Life\",\n",
349
+ "\"GG\":\"Good Game\",\n",
350
+ "\"GN\":\"Good Night\",\n",
351
+ "\"GMTA\":\"Great Minds Think Alike\",\n",
352
+ "\"GR8\":\"Great\",\n",
353
+ "\"G9\":\"Genius\",\n",
354
+ "\"IC\":\"I See\",\n",
355
+ "\"ICQ\":\"I Seek you\",\n",
356
+ "\"ILU\":\"I Love You\",\n",
357
+ "\"IMHO\":\"In My Honest/Humble Opinion\",\n",
358
+ "\"IMO\":\"In My Opinion\",\n",
359
+ "\"IOW\":\"In Other Words\",\n",
360
+ "\"IRL\":\"In Real Life\",\n",
361
+ "\"KISS\":\"Keep It Simple Stupid\",\n",
362
+ "\"LDR\":\"Long Distance Relationship\",\n",
363
+ "\"LMAO\":\"Laugh My A Off\",\n",
364
+ "\"LOL\":\"Laughing Out Loud\",\n",
365
+ "\"LTNS\":\"Long Time No See\",\n",
366
+ "\"L8R\":\"Later\",\n",
367
+ "\"MTE\":\"My Thoughts Exactly\",\n",
368
+ "\"M8\":\"Mate\",\n",
369
+ "\"NRN\":\"No Reply Necessary\",\n",
370
+ "\"OIC\":\"Oh I See\",\n",
371
+ "\"PITA\":\"Pain In The A\",\n",
372
+ "\"PRT\":\"Party\",\n",
373
+ "\"PRW\":\"Parents Are Watching\",\n",
374
+ "\"QPSA\":\"Que Pasa?\",\n",
375
+ "\"ROFL\":\"Rolling On The Floor Laughing\",\n",
376
+ "\"ROFLOL\":\"Rolling On The Floor Laughing Out Loud\",\n",
377
+ "\"ROTFLMAO\":\"Rolling On The Floor Laughing My A Off\",\n",
378
+ "\"SK8\":\"Skate\",\n",
379
+ "\"STATS\":\"Your sex and age\",\n",
380
+ "\"ASL\":\"Age, Sex, Location\",\n",
381
+ "\"THX\":\"Thank You\",\n",
382
+ "\"TTFN\":\"Ta-Ta For Now\",\n",
383
+ "\"TTYL\":\"Talk To You Later\",\n",
384
+ "\"U\":\"You\",\n",
385
+ "\"U2\":\"You Too\",\n",
386
+ "\"U4E\":\"Yours For Ever\",\n",
387
+ "\"WB\":\"Welcome Back\",\n",
388
+ "\"WTF\":\"What The F\",\n",
389
+ "\"WTG\":\"Way To Go\",\n",
390
+ "\"WUF\":\"Where Are You From\",\n",
391
+ "'W8':'Wait',\n",
392
+ "'7K':'Sick D Laugher'}"
393
+ ]
394
+ },
395
+ {
396
+ "cell_type": "code",
397
+ "execution_count": null,
398
+ "metadata": {
399
+ "execution": {
400
+ "iopub.execute_input": "2023-02-28T09:01:59.138690Z",
401
+ "iopub.status.busy": "2023-02-28T09:01:59.138079Z",
402
+ "iopub.status.idle": "2023-02-28T09:01:59.148390Z",
403
+ "shell.execute_reply": "2023-02-28T09:01:59.147289Z",
404
+ "shell.execute_reply.started": "2023-02-28T09:01:59.138632Z"
405
+ }
406
+ },
407
+ "outputs": [],
408
+ "source": [
409
+ "def chart_conversations(text):\n",
410
+ " new_text = []\n",
411
+ " for w in text.split():\n",
412
+ " if w.upper() in chart_words:\n",
413
+ " new_text.append(chart_words[w.upper()])\n",
414
+ " else:\n",
415
+ " new_text.append(w)\n",
416
+ " return \" \".join(new_text)"
417
+ ]
418
+ },
419
+ {
420
+ "cell_type": "code",
421
+ "execution_count": null,
422
+ "metadata": {
423
+ "execution": {
424
+ "iopub.execute_input": "2023-02-28T09:02:01.222894Z",
425
+ "iopub.status.busy": "2023-02-28T09:02:01.221976Z",
426
+ "iopub.status.idle": "2023-02-28T09:02:01.230050Z",
427
+ "shell.execute_reply": "2023-02-28T09:02:01.228866Z",
428
+ "shell.execute_reply.started": "2023-02-28T09:02:01.222848Z"
429
+ }
430
+ },
431
+ "outputs": [],
432
+ "source": [
433
+ "nm = \"Hello , WUF , CUL8R , FAQ , BBL\"\n",
434
+ "chart_conversations(nm)"
435
+ ]
436
+ },
437
+ {
438
+ "cell_type": "markdown",
439
+ "metadata": {},
440
+ "source": [
441
+ "### - Spelling Correction:(spcy, textbolb, pyspellchecker)"
442
+ ]
443
+ },
444
+ {
445
+ "cell_type": "code",
446
+ "execution_count": null,
447
+ "metadata": {
448
+ "execution": {
449
+ "iopub.execute_input": "2023-02-28T09:02:05.938121Z",
450
+ "iopub.status.busy": "2023-02-28T09:02:05.936910Z",
451
+ "iopub.status.idle": "2023-02-28T09:02:06.457439Z",
452
+ "shell.execute_reply": "2023-02-28T09:02:06.456315Z",
453
+ "shell.execute_reply.started": "2023-02-28T09:02:05.938064Z"
454
+ }
455
+ },
456
+ "outputs": [],
457
+ "source": [
458
+ "from textblob import TextBlob"
459
+ ]
460
+ },
461
+ {
462
+ "cell_type": "code",
463
+ "execution_count": null,
464
+ "metadata": {
465
+ "execution": {
466
+ "iopub.execute_input": "2023-02-28T09:02:08.338208Z",
467
+ "iopub.status.busy": "2023-02-28T09:02:08.337106Z",
468
+ "iopub.status.idle": "2023-02-28T09:02:09.128963Z",
469
+ "shell.execute_reply": "2023-02-28T09:02:09.127873Z",
470
+ "shell.execute_reply.started": "2023-02-28T09:02:08.338165Z"
471
+ }
472
+ },
473
+ "outputs": [],
474
+ "source": [
475
+ "incorrect_text = \"certain conditions several ggenaeration ,read the notebook and alos like notboook\"\n",
476
+ "\n",
477
+ "# Spelling correction by Textblob\n",
478
+ "textBlob = TextBlob(incorrect_text)\n",
479
+ "textBlob.correct().string"
480
+ ]
481
+ },
482
+ {
483
+ "cell_type": "markdown",
484
+ "metadata": {},
485
+ "source": [
486
+ "### - Removing Stopwords\n",
487
+ "for POS - tagging we don't use stopword to remove is,am,are,was,and,but..."
488
+ ]
489
+ },
490
+ {
491
+ "cell_type": "code",
492
+ "execution_count": 9,
493
+ "metadata": {
494
+ "execution": {
495
+ "iopub.execute_input": "2023-02-28T09:02:12.057700Z",
496
+ "iopub.status.busy": "2023-02-28T09:02:12.057305Z",
497
+ "iopub.status.idle": "2023-02-28T09:02:12.070805Z",
498
+ "shell.execute_reply": "2023-02-28T09:02:12.068811Z",
499
+ "shell.execute_reply.started": "2023-02-28T09:02:12.057663Z"
500
+ }
501
+ },
502
+ "outputs": [
503
+ {
504
+ "data": {
505
+ "text/plain": [
506
+ "\"nltk.download('stopwords')\""
507
+ ]
508
+ },
509
+ "execution_count": 9,
510
+ "metadata": {},
511
+ "output_type": "execute_result"
512
+ }
513
+ ],
514
+ "source": [
515
+ "# Import the library and download the stop words:\n",
516
+ "from nltk.corpus import stopwords\n",
517
+ "stp = stopwords.words('english')\n",
518
+ "\n",
519
+ "# Other method if nltk stop words not present\n",
520
+ "'''nltk.download('stopwords')'''"
521
+ ]
522
+ },
523
+ {
524
+ "cell_type": "code",
525
+ "execution_count": 10,
526
+ "metadata": {
527
+ "execution": {
528
+ "iopub.execute_input": "2023-02-28T09:02:14.667306Z",
529
+ "iopub.status.busy": "2023-02-28T09:02:14.666909Z",
530
+ "iopub.status.idle": "2023-02-28T09:02:14.673664Z",
531
+ "shell.execute_reply": "2023-02-28T09:02:14.672527Z",
532
+ "shell.execute_reply.started": "2023-02-28T09:02:14.667267Z"
533
+ }
534
+ },
535
+ "outputs": [],
536
+ "source": [
537
+ "# Define a function to remove stop words from the text:\n",
538
+ "def remove_stopwords(text):\n",
539
+ " new_text = []\n",
540
+ " \n",
541
+ " for word in text.split():\n",
542
+ " if word in stp: # stp = stopwords.words('english')\n",
543
+ " new_text.append('')\n",
544
+ " else:\n",
545
+ " new_text.append(word)\n",
546
+ " \n",
547
+ " x = new_text[:]\n",
548
+ " new_text.clear()\n",
549
+ " return \" \".join(x)"
550
+ ]
551
+ },
552
+ {
553
+ "cell_type": "code",
554
+ "execution_count": 11,
555
+ "metadata": {
556
+ "execution": {
557
+ "iopub.execute_input": "2023-02-28T09:02:16.297289Z",
558
+ "iopub.status.busy": "2023-02-28T09:02:16.296887Z",
559
+ "iopub.status.idle": "2023-02-28T09:02:39.152572Z",
560
+ "shell.execute_reply": "2023-02-28T09:02:39.151496Z",
561
+ "shell.execute_reply.started": "2023-02-28T09:02:16.297251Z"
562
+ }
563
+ },
564
+ "outputs": [],
565
+ "source": [
566
+ "df['review'] = df['review'].apply(remove_stopwords)"
567
+ ]
568
+ },
569
+ {
570
+ "cell_type": "markdown",
571
+ "metadata": {},
572
+ "source": [
573
+ "### - Handling Emoji\n",
574
+ "- **Replace with meaning** -\n",
575
+ "We can remove all emojis from the text using regular expressions\n",
576
+ "- **Remove** -\n",
577
+ "We can replace emojis with a text representation."
578
+ ]
579
+ },
580
+ {
581
+ "cell_type": "code",
582
+ "execution_count": 12,
583
+ "metadata": {
584
+ "execution": {
585
+ "iopub.execute_input": "2023-02-28T09:02:43.119351Z",
586
+ "iopub.status.busy": "2023-02-28T09:02:43.118942Z",
587
+ "iopub.status.idle": "2023-02-28T09:02:43.125800Z",
588
+ "shell.execute_reply": "2023-02-28T09:02:43.124522Z",
589
+ "shell.execute_reply.started": "2023-02-28T09:02:43.119314Z"
590
+ }
591
+ },
592
+ "outputs": [],
593
+ "source": [
594
+ "# Remove by usning Regular expression\n",
595
+ "def remove_emoji(text):\n",
596
+ " emoji_pattern = re.compile(\"[\"\n",
597
+ " u\"\\U0001F600-\\U0001F64F\" # emoticons\n",
598
+ " u\"\\U0001F300-\\U0001F5FF\" # symbols & pictographs\n",
599
+ " u\"\\U0001F680-\\U0001F6FF\" # transport & map symbols\n",
600
+ " u\"\\U0001F1E0-\\U0001F1FF\" # flags (iOS)\n",
601
+ " \"]+\", flags=re.UNICODE)\n",
602
+ " return emoji_pattern.sub(r'', text)"
603
+ ]
604
+ },
605
+ {
606
+ "cell_type": "code",
607
+ "execution_count": 13,
608
+ "metadata": {
609
+ "execution": {
610
+ "iopub.execute_input": "2023-02-28T09:02:45.558806Z",
611
+ "iopub.status.busy": "2023-02-28T09:02:45.557737Z",
612
+ "iopub.status.idle": "2023-02-28T09:02:45.568747Z",
613
+ "shell.execute_reply": "2023-02-28T09:02:45.567353Z",
614
+ "shell.execute_reply.started": "2023-02-28T09:02:45.558761Z"
615
+ }
616
+ },
617
+ "outputs": [
618
+ {
619
+ "data": {
620
+ "text/plain": [
621
+ "'hello, world ,, '"
622
+ ]
623
+ },
624
+ "execution_count": 13,
625
+ "metadata": {},
626
+ "output_type": "execute_result"
627
+ }
628
+ ],
629
+ "source": [
630
+ "emoji_text = \"hello, world 😀,😃,😄 😈 😀\"\n",
631
+ "remove_emoji(emoji_text)"
632
+ ]
633
+ },
634
+ {
635
+ "cell_type": "code",
636
+ "execution_count": null,
637
+ "metadata": {
638
+ "execution": {
639
+ "iopub.execute_input": "2023-02-28T09:02:48.839342Z",
640
+ "iopub.status.busy": "2023-02-28T09:02:48.838411Z",
641
+ "iopub.status.idle": "2023-02-28T09:02:59.528188Z",
642
+ "shell.execute_reply": "2023-02-28T09:02:59.526961Z",
643
+ "shell.execute_reply.started": "2023-02-28T09:02:48.839294Z"
644
+ }
645
+ },
646
+ "outputs": [],
647
+ "source": [
648
+ "!pip install emoji"
649
+ ]
650
+ },
651
+ {
652
+ "cell_type": "code",
653
+ "execution_count": null,
654
+ "metadata": {
655
+ "execution": {
656
+ "iopub.execute_input": "2023-02-28T09:03:01.798077Z",
657
+ "iopub.status.busy": "2023-02-28T09:03:01.797654Z",
658
+ "iopub.status.idle": "2023-02-28T09:03:01.833902Z",
659
+ "shell.execute_reply": "2023-02-28T09:03:01.832698Z",
660
+ "shell.execute_reply.started": "2023-02-28T09:03:01.798028Z"
661
+ }
662
+ },
663
+ "outputs": [],
664
+ "source": [
665
+ "# Replacing emoji to text\n",
666
+ "import emoji\n",
667
+ "\n",
668
+ "print(emoji.demojize(\"hello, world 😀,😃,😄 😈 😀\"))"
669
+ ]
670
+ },
671
+ {
672
+ "cell_type": "markdown",
673
+ "metadata": {},
674
+ "source": [
675
+ "### - Tokenizations :\n",
676
+ "**- Word Tokenization**\n",
677
+ "\n",
678
+ "**- Sentence Tokenization**\n",
679
+ "\n",
680
+ "**White space tokenization:** This method splits a text into tokens based on the white space characters (e.g., spaces, tabs, newlines) between them. This is the simplest form of tokenization and can be implemented using the split() function in Python.\n",
681
+ "\n",
682
+ "**Punctuation-based tokenization:** This method splits a text into tokens based on the punctuation marks between them. This method is more complex than white space tokenization and can be implemented using regular expressions or the nltk library in Python.\n",
683
+ "\n",
684
+ "**Word-based tokenization:** This method splits a text into tokens based on the words between them. This method is more complex than white space tokenization and requires a language model that can identify the boundaries between words. The nltk library provides several pre-trained models for word-based tokenization, including the punkt model."
685
+ ]
686
+ },
687
+ {
688
+ "cell_type": "code",
689
+ "execution_count": null,
690
+ "metadata": {
691
+ "execution": {
692
+ "iopub.execute_input": "2023-02-28T09:03:07.908166Z",
693
+ "iopub.status.busy": "2023-02-28T09:03:07.907155Z",
694
+ "iopub.status.idle": "2023-02-28T09:03:07.913903Z",
695
+ "shell.execute_reply": "2023-02-28T09:03:07.912592Z",
696
+ "shell.execute_reply.started": "2023-02-28T09:03:07.908110Z"
697
+ }
698
+ },
699
+ "outputs": [],
700
+ "source": [
701
+ "sent_1 = \"This method splits by sentences. This tokenization implemented\"\n",
702
+ "sent_2 = \"This method splits by word.This tokenization implemented\"\n",
703
+ "\n",
704
+ "# By Using NLTK\n",
705
+ "from nltk.tokenize import word_tokenize ,sent_tokenize"
706
+ ]
707
+ },
708
+ {
709
+ "cell_type": "code",
710
+ "execution_count": null,
711
+ "metadata": {
712
+ "execution": {
713
+ "iopub.execute_input": "2023-02-28T09:03:10.058110Z",
714
+ "iopub.status.busy": "2023-02-28T09:03:10.057093Z",
715
+ "iopub.status.idle": "2023-02-28T09:03:10.079265Z",
716
+ "shell.execute_reply": "2023-02-28T09:03:10.078026Z",
717
+ "shell.execute_reply.started": "2023-02-28T09:03:10.058047Z"
718
+ }
719
+ },
720
+ "outputs": [],
721
+ "source": [
722
+ "print('sentence_tokenize -',sent_tokenize(sent_1))\n",
723
+ "print('word_tokenize -',word_tokenize(sent_2))"
724
+ ]
725
+ },
726
+ {
727
+ "cell_type": "code",
728
+ "execution_count": null,
729
+ "metadata": {
730
+ "execution": {
731
+ "iopub.execute_input": "2023-02-28T09:03:12.943338Z",
732
+ "iopub.status.busy": "2023-02-28T09:03:12.942087Z",
733
+ "iopub.status.idle": "2023-02-28T09:03:36.465661Z",
734
+ "shell.execute_reply": "2023-02-28T09:03:36.464382Z",
735
+ "shell.execute_reply.started": "2023-02-28T09:03:12.943284Z"
736
+ }
737
+ },
738
+ "outputs": [],
739
+ "source": [
740
+ "# By Using Spacy\n",
741
+ "import spacy\n",
742
+ "nlp = spacy.load('en_core_web_sm')\n",
743
+ "\n",
744
+ "doc1 = nlp(sent_1)\n",
745
+ "doc2 = nlp(sent_2)\n",
746
+ "\n",
747
+ "sent1 = []\n",
748
+ "sent2 = []\n",
749
+ "for token in doc1:\n",
750
+ " sent1.append(token)\n",
751
+ "for token in doc2:\n",
752
+ " sent2.append(token)\n",
753
+ "print('sent_1 tokenize',sent1)\n",
754
+ "print('sent_2 tokenize',sent2)"
755
+ ]
756
+ },
757
+ {
758
+ "cell_type": "code",
759
+ "execution_count": 14,
760
+ "metadata": {
761
+ "execution": {
762
+ "iopub.execute_input": "2023-02-28T09:03:36.468767Z",
763
+ "iopub.status.busy": "2023-02-28T09:03:36.467757Z",
764
+ "iopub.status.idle": "2023-02-28T09:04:05.529030Z",
765
+ "shell.execute_reply": "2023-02-28T09:04:05.527967Z",
766
+ "shell.execute_reply.started": "2023-02-28T09:03:36.468723Z"
767
+ }
768
+ },
769
+ "outputs": [],
770
+ "source": [
771
+ "# Apply nltk word_tokenize in imdb data\n",
772
+ "from nltk.tokenize import word_tokenize\n",
773
+ "def wrd_token(text):\n",
774
+ " return word_tokenize(text)\n",
775
+ "df['review'] = df['review'].apply(wrd_token)"
776
+ ]
777
+ },
778
+ {
779
+ "cell_type": "markdown",
780
+ "metadata": {},
781
+ "source": [
782
+ "### - Stemming :(It is slow in processing)\n"
783
+ ]
784
+ },
785
+ {
786
+ "cell_type": "code",
787
+ "execution_count": 17,
788
+ "metadata": {
789
+ "execution": {
790
+ "iopub.execute_input": "2023-02-28T09:04:35.737577Z",
791
+ "iopub.status.busy": "2023-02-28T09:04:35.736859Z",
792
+ "iopub.status.idle": "2023-02-28T09:04:35.743182Z",
793
+ "shell.execute_reply": "2023-02-28T09:04:35.741453Z",
794
+ "shell.execute_reply.started": "2023-02-28T09:04:35.737534Z"
795
+ }
796
+ },
797
+ "outputs": [],
798
+ "source": [
799
+ "from nltk.stem.porter import PorterStemmer\n",
800
+ "ps = PorterStemmer()"
801
+ ]
802
+ },
803
+ {
804
+ "cell_type": "code",
805
+ "execution_count": 18,
806
+ "metadata": {
807
+ "execution": {
808
+ "iopub.execute_input": "2023-02-28T09:04:46.312604Z",
809
+ "iopub.status.busy": "2023-02-28T09:04:46.311973Z",
810
+ "iopub.status.idle": "2023-02-28T09:07:17.076444Z",
811
+ "shell.execute_reply": "2023-02-28T09:07:17.075197Z",
812
+ "shell.execute_reply.started": "2023-02-28T09:04:46.312561Z"
813
+ }
814
+ },
815
+ "outputs": [
816
+ {
817
+ "data": {
818
+ "text/plain": [
819
+ "0 one review mention watch 1 oz episod youll hoo...\n",
820
+ "1 wonder littl product film techniqu unassum old...\n",
821
+ "2 thought wonder way spend time hot summer weeke...\n",
822
+ "3 basic there famili littl boy jake think there ...\n",
823
+ "4 petter mattei love time money visual stun film...\n",
824
+ " ... \n",
825
+ "49995 thought movi right good job wasnt creativ orig...\n",
826
+ "49996 bad plot bad dialogu bad act idiot direct anno...\n",
827
+ "49997 cathol taught parochi elementari school nun ta...\n",
828
+ "49998 im go disagre previou comment side maltin one ...\n",
829
+ "49999 one expect star trek movi high art fan expect ...\n",
830
+ "Name: review, Length: 50000, dtype: object"
831
+ ]
832
+ },
833
+ "execution_count": 18,
834
+ "metadata": {},
835
+ "output_type": "execute_result"
836
+ }
837
+ ],
838
+ "source": [
839
+ "# Function for applying stemming function\n",
840
+ "def stem_words(text):\n",
841
+ " return \" \".join([ps.stem(word) for word in text])\n",
842
+ "\n",
843
+ "df['review'].apply(stem_words)"
844
+ ]
845
+ },
846
+ {
847
+ "cell_type": "markdown",
848
+ "metadata": {},
849
+ "source": [
850
+ "### - Lemmatization :\n"
851
+ ]
852
+ },
853
+ {
854
+ "cell_type": "code",
855
+ "execution_count": null,
856
+ "metadata": {
857
+ "execution": {
858
+ "iopub.execute_input": "2023-02-28T09:12:05.953498Z",
859
+ "iopub.status.busy": "2023-02-28T09:12:05.952776Z",
860
+ "iopub.status.idle": "2023-02-28T09:12:12.682133Z",
861
+ "shell.execute_reply": "2023-02-28T09:12:12.679291Z",
862
+ "shell.execute_reply.started": "2023-02-28T09:12:05.953435Z"
863
+ }
864
+ },
865
+ "outputs": [],
866
+ "source": [
867
+ "import nltk\n",
868
+ "from nltk.stem import WordNetLemmatizer\n",
869
+ "nltk.download() \n",
870
+ "lemmatizer = WordNetLemmatizer()\n",
871
+ "\n",
872
+ "def lemma_words(text):\n",
873
+ " return \" \".join([lemmatizer.lemmatize(word) for word in text])"
874
+ ]
875
+ },
876
+ {
877
+ "cell_type": "code",
878
+ "execution_count": 27,
879
+ "metadata": {
880
+ "execution": {
881
+ "iopub.execute_input": "2023-02-28T09:12:39.848502Z",
882
+ "iopub.status.busy": "2023-02-28T09:12:39.847845Z",
883
+ "iopub.status.idle": "2023-02-28T09:15:17.653995Z",
884
+ "shell.execute_reply": "2023-02-28T09:15:17.652811Z",
885
+ "shell.execute_reply.started": "2023-02-28T09:12:39.848457Z"
886
+ }
887
+ },
888
+ "outputs": [],
889
+ "source": [
890
+ "df['lemma_review'] = df['review'].astype(str) #.apply(stem_words) # fix ---- already stemed previously, and need to be list of string"
891
+ ]
892
+ },
893
+ {
894
+ "cell_type": "code",
895
+ "execution_count": null,
896
+ "metadata": {
897
+ "execution": {
898
+ "iopub.execute_input": "2023-02-28T09:09:25.548239Z",
899
+ "iopub.status.busy": "2023-02-28T09:09:25.547782Z",
900
+ "iopub.status.idle": "2023-02-28T09:09:25.595610Z",
901
+ "shell.execute_reply": "2023-02-28T09:09:25.594356Z",
902
+ "shell.execute_reply.started": "2023-02-28T09:09:25.548199Z"
903
+ }
904
+ },
905
+ "outputs": [],
906
+ "source": [
907
+ "# Total number of words in corpus and number of unique word.\n",
908
+ "merge_list = []\n",
909
+ "for row in df['review'][0:5000]:\n",
910
+ " merge_list.extend(row)\n",
911
+ "print('No. of word in corpus - ',len(merge_list))\n",
912
+ "print('No. of unique word in corpus - ',len(set(merge_list)))"
913
+ ]
914
+ },
915
+ {
916
+ "cell_type": "markdown",
917
+ "metadata": {},
918
+ "source": [
919
+ "## 2. Text Representations Or Text Vectorization:\n",
920
+ "\n",
921
+ "### - Bag of word (Text classification)\n",
922
+ "\n"
923
+ ]
924
+ },
925
+ {
926
+ "cell_type": "code",
927
+ "execution_count": null,
928
+ "metadata": {
929
+ "execution": {
930
+ "iopub.execute_input": "2023-02-28T08:59:46.519000Z",
931
+ "iopub.status.busy": "2023-02-28T08:59:46.516506Z",
932
+ "iopub.status.idle": "2023-02-28T08:59:51.295200Z",
933
+ "shell.execute_reply": "2023-02-28T08:59:51.294131Z",
934
+ "shell.execute_reply.started": "2023-02-28T08:59:46.518957Z"
935
+ }
936
+ },
937
+ "outputs": [],
938
+ "source": [
939
+ "from sklearn.feature_extraction.text import CountVectorizer\n",
940
+ "cv = CountVectorizer()\n",
941
+ "bow = cv.fit_transform(df['lemma_review'])"
942
+ ]
943
+ },
944
+ {
945
+ "cell_type": "code",
946
+ "execution_count": null,
947
+ "metadata": {
948
+ "execution": {
949
+ "iopub.execute_input": "2023-02-28T08:59:51.301302Z",
950
+ "iopub.status.busy": "2023-02-28T08:59:51.300748Z"
951
+ }
952
+ },
953
+ "outputs": [],
954
+ "source": [
955
+ "bow.toarray()"
956
+ ]
957
+ },
958
+ {
959
+ "cell_type": "markdown",
960
+ "metadata": {},
961
+ "source": [
962
+ "### - N-Grams or Bag of Ngrams\n",
963
+ "\n",
964
+ "Dimension increase with increase in ngrams, It slows down the Algorithim and out of vocabulary ignored."
965
+ ]
966
+ },
967
+ {
968
+ "cell_type": "code",
969
+ "execution_count": null,
970
+ "metadata": {
971
+ "execution": {
972
+ "iopub.execute_input": "2023-02-28T09:00:17.147997Z",
973
+ "iopub.status.busy": "2023-02-28T09:00:17.147340Z",
974
+ "iopub.status.idle": "2023-02-28T09:00:18.009694Z",
975
+ "shell.execute_reply": "2023-02-28T09:00:18.008034Z",
976
+ "shell.execute_reply.started": "2023-02-28T09:00:17.147955Z"
977
+ }
978
+ },
979
+ "outputs": [],
980
+ "source": [
981
+ "from sklearn.feature_extraction.text import CountVectorizer\n",
982
+ "cv_1 = CountVectorizer(ngram_range=(10,10))\n",
983
+ "bow2 = cv_1.fit_transform(df['lemma_review'])"
984
+ ]
985
+ },
986
+ {
987
+ "cell_type": "code",
988
+ "execution_count": null,
989
+ "metadata": {},
990
+ "outputs": [],
991
+ "source": [
992
+ "bow2.toarray()"
993
+ ]
994
+ },
995
+ {
996
+ "cell_type": "markdown",
997
+ "metadata": {},
998
+ "source": [
999
+ "### - Tf - idf (Term frequency and Inverse Document frequency)\n",
1000
+ "\n",
1001
+ "There sparcity present and out of vocabulary ignore, Dimension large if vocabulary large and symantic relationship not capture."
1002
+ ]
1003
+ },
1004
+ {
1005
+ "cell_type": "code",
1006
+ "execution_count": 28,
1007
+ "metadata": {
1008
+ "execution": {
1009
+ "iopub.execute_input": "2023-02-28T09:17:00.313046Z",
1010
+ "iopub.status.busy": "2023-02-28T09:17:00.312563Z",
1011
+ "iopub.status.idle": "2023-02-28T09:17:01.216547Z",
1012
+ "shell.execute_reply": "2023-02-28T09:17:01.214914Z",
1013
+ "shell.execute_reply.started": "2023-02-28T09:17:00.313002Z"
1014
+ }
1015
+ },
1016
+ "outputs": [],
1017
+ "source": [
1018
+ "from sklearn.feature_extraction.text import TfidfVectorizer\n",
1019
+ "tfidf = TfidfVectorizer()\n",
1020
+ "tf_idf = tfidf.fit_transform(df['lemma_review'])"
1021
+ ]
1022
+ },
1023
+ {
1024
+ "cell_type": "code",
1025
+ "execution_count": 29,
1026
+ "metadata": {
1027
+ "execution": {
1028
+ "iopub.execute_input": "2023-02-28T09:16:54.789060Z",
1029
+ "iopub.status.busy": "2023-02-28T09:16:54.787898Z",
1030
+ "iopub.status.idle": "2023-02-28T09:16:54.868566Z",
1031
+ "shell.execute_reply": "2023-02-28T09:16:54.866662Z",
1032
+ "shell.execute_reply.started": "2023-02-28T09:16:54.789007Z"
1033
+ }
1034
+ },
1035
+ "outputs": [
1036
+ {
1037
+ "data": {
1038
+ "text/plain": [
1039
+ "array([[0., 0., 0., ..., 0., 0., 0.],\n",
1040
+ " [0., 0., 0., ..., 0., 0., 0.],\n",
1041
+ " [0., 0., 0., ..., 0., 0., 0.],\n",
1042
+ " ...,\n",
1043
+ " [0., 0., 0., ..., 0., 0., 0.],\n",
1044
+ " [0., 0., 0., ..., 0., 0., 0.],\n",
1045
+ " [0., 0., 0., ..., 0., 0., 0.]])"
1046
+ ]
1047
+ },
1048
+ "execution_count": 29,
1049
+ "metadata": {},
1050
+ "output_type": "execute_result"
1051
+ }
1052
+ ],
1053
+ "source": [
1054
+ "tf_idf.toarray()"
1055
+ ]
1056
+ },
1057
+ {
1058
+ "cell_type": "code",
1059
+ "execution_count": null,
1060
+ "metadata": {},
1061
+ "outputs": [],
1062
+ "source": []
1063
+ },
1064
+ {
1065
+ "cell_type": "code",
1066
+ "execution_count": null,
1067
+ "metadata": {},
1068
+ "outputs": [],
1069
+ "source": []
1070
+ },
1071
+ {
1072
+ "cell_type": "code",
1073
+ "execution_count": null,
1074
+ "metadata": {},
1075
+ "outputs": [],
1076
+ "source": []
1077
+ },
1078
+ {
1079
+ "cell_type": "code",
1080
+ "execution_count": null,
1081
+ "metadata": {},
1082
+ "outputs": [],
1083
+ "source": []
1084
+ },
1085
+ {
1086
+ "cell_type": "code",
1087
+ "execution_count": null,
1088
+ "metadata": {},
1089
+ "outputs": [],
1090
+ "source": [
1091
+ "df['review'][0]"
1092
+ ]
1093
+ },
1094
+ {
1095
+ "cell_type": "code",
1096
+ "execution_count": null,
1097
+ "metadata": {},
1098
+ "outputs": [],
1099
+ "source": []
1100
+ }
1101
+ ],
1102
+ "metadata": {
1103
+ "kernelspec": {
1104
+ "display_name": "Python 3",
1105
+ "language": "python",
1106
+ "name": "python3"
1107
+ },
1108
+ "language_info": {
1109
+ "codemirror_mode": {
1110
+ "name": "ipython",
1111
+ "version": 3
1112
+ },
1113
+ "file_extension": ".py",
1114
+ "mimetype": "text/x-python",
1115
+ "name": "python",
1116
+ "nbconvert_exporter": "python",
1117
+ "pygments_lexer": "ipython3",
1118
+ "version": "3.10.12"
1119
+ }
1120
+ },
1121
+ "nbformat": 4,
1122
+ "nbformat_minor": 4
1123
+ }
benchmark/NBspecific_1/NBspecific_1_reproduced.ipynb ADDED
@@ -0,0 +1,1096 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {
7
+ "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
8
+ "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
9
+ "execution": {
10
+ "iopub.execute_input": "2023-02-28T09:01:35.199038Z",
11
+ "iopub.status.busy": "2023-02-28T09:01:35.198153Z",
12
+ "iopub.status.idle": "2023-02-28T09:01:35.214562Z",
13
+ "shell.execute_reply": "2023-02-28T09:01:35.213234Z",
14
+ "shell.execute_reply.started": "2023-02-28T09:01:35.198993Z"
15
+ }
16
+ },
17
+ "outputs": [
18
+ {
19
+ "name": "stdout",
20
+ "output_type": "stream",
21
+ "text": [
22
+ "data/IMDB Dataset.csv\n"
23
+ ]
24
+ }
25
+ ],
26
+ "source": [
27
+ "# This Python 3 environment comes with many helpful analytics libraries installed\n",
28
+ "# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n",
29
+ "# For example, here's several helpful packages to load\n",
30
+ "\n",
31
+ "import numpy as np # linear algebra\n",
32
+ "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
33
+ "\n",
34
+ "# Input data files are available in the read-only \"../input/\" directory\n",
35
+ "# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n",
36
+ "\n",
37
+ "import os\n",
38
+ "for dirname, _, filenames in os.walk('data'):\n",
39
+ " for filename in filenames:\n",
40
+ " print(os.path.join(dirname, filename))\n",
41
+ "\n",
42
+ "# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n",
43
+ "# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session"
44
+ ]
45
+ },
46
+ {
47
+ "cell_type": "code",
48
+ "execution_count": 2,
49
+ "metadata": {
50
+ "execution": {
51
+ "iopub.execute_input": "2023-02-28T09:01:37.498012Z",
52
+ "iopub.status.busy": "2023-02-28T09:01:37.497070Z",
53
+ "iopub.status.idle": "2023-02-28T09:01:37.502150Z",
54
+ "shell.execute_reply": "2023-02-28T09:01:37.501011Z",
55
+ "shell.execute_reply.started": "2023-02-28T09:01:37.497972Z"
56
+ }
57
+ },
58
+ "outputs": [],
59
+ "source": [
60
+ "import re # Regular expression"
61
+ ]
62
+ },
63
+ {
64
+ "cell_type": "markdown",
65
+ "metadata": {},
66
+ "source": [
67
+ "## 1. Data Accqasation\n",
68
+ "This notebook will do basic IMDB reviews sentiment analysis. As show in below image, we will be performing few text cleaning and model building techniques. The flow of the notebook."
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": 3,
74
+ "metadata": {
75
+ "execution": {
76
+ "iopub.execute_input": "2023-02-28T09:01:40.837603Z",
77
+ "iopub.status.busy": "2023-02-28T09:01:40.836859Z",
78
+ "iopub.status.idle": "2023-02-28T09:01:42.179878Z",
79
+ "shell.execute_reply": "2023-02-28T09:01:42.178776Z",
80
+ "shell.execute_reply.started": "2023-02-28T09:01:40.837558Z"
81
+ }
82
+ },
83
+ "outputs": [
84
+ {
85
+ "data": {
86
+ "text/html": [
87
+ "<div>\n",
88
+ "<style scoped>\n",
89
+ " .dataframe tbody tr th:only-of-type {\n",
90
+ " vertical-align: middle;\n",
91
+ " }\n",
92
+ "\n",
93
+ " .dataframe tbody tr th {\n",
94
+ " vertical-align: top;\n",
95
+ " }\n",
96
+ "\n",
97
+ " .dataframe thead th {\n",
98
+ " text-align: right;\n",
99
+ " }\n",
100
+ "</style>\n",
101
+ "<table border=\"1\" class=\"dataframe\">\n",
102
+ " <thead>\n",
103
+ " <tr style=\"text-align: right;\">\n",
104
+ " <th></th>\n",
105
+ " <th>review</th>\n",
106
+ " <th>sentiment</th>\n",
107
+ " </tr>\n",
108
+ " </thead>\n",
109
+ " <tbody>\n",
110
+ " <tr>\n",
111
+ " <th>0</th>\n",
112
+ " <td>One of the other reviewers has mentioned that ...</td>\n",
113
+ " <td>positive</td>\n",
114
+ " </tr>\n",
115
+ " <tr>\n",
116
+ " <th>1</th>\n",
117
+ " <td>A wonderful little production. &lt;br /&gt;&lt;br /&gt;The...</td>\n",
118
+ " <td>positive</td>\n",
119
+ " </tr>\n",
120
+ " <tr>\n",
121
+ " <th>2</th>\n",
122
+ " <td>I thought this was a wonderful way to spend ti...</td>\n",
123
+ " <td>positive</td>\n",
124
+ " </tr>\n",
125
+ " <tr>\n",
126
+ " <th>3</th>\n",
127
+ " <td>Basically there's a family where a little boy ...</td>\n",
128
+ " <td>negative</td>\n",
129
+ " </tr>\n",
130
+ " <tr>\n",
131
+ " <th>4</th>\n",
132
+ " <td>Petter Mattei's \"Love in the Time of Money\" is...</td>\n",
133
+ " <td>positive</td>\n",
134
+ " </tr>\n",
135
+ " </tbody>\n",
136
+ "</table>\n",
137
+ "</div>"
138
+ ],
139
+ "text/plain": [
140
+ " review sentiment\n",
141
+ "0 One of the other reviewers has mentioned that ... positive\n",
142
+ "1 A wonderful little production. <br /><br />The... positive\n",
143
+ "2 I thought this was a wonderful way to spend ti... positive\n",
144
+ "3 Basically there's a family where a little boy ... negative\n",
145
+ "4 Petter Mattei's \"Love in the Time of Money\" is... positive"
146
+ ]
147
+ },
148
+ "execution_count": 3,
149
+ "metadata": {},
150
+ "output_type": "execute_result"
151
+ }
152
+ ],
153
+ "source": [
154
+ "df = pd.read_csv(\"data/IMDB Dataset.csv\")\n",
155
+ "df.head()"
156
+ ]
157
+ },
158
+ {
159
+ "cell_type": "markdown",
160
+ "metadata": {},
161
+ "source": [
162
+ "## 1. Text Preprocessing\n",
163
+ "- Lower casing\n",
164
+ "- Remove HTML Tags\n",
165
+ "- Remove Punctuations\n",
166
+ "- Remove Stopwords\n",
167
+ "- Steamming and Lemmatization\n",
168
+ "- Observation"
169
+ ]
170
+ },
171
+ {
172
+ "cell_type": "code",
173
+ "execution_count": null,
174
+ "metadata": {
175
+ "execution": {
176
+ "iopub.execute_input": "2023-02-28T09:01:44.623338Z",
177
+ "iopub.status.busy": "2023-02-28T09:01:44.622496Z",
178
+ "iopub.status.idle": "2023-02-28T09:01:44.635713Z",
179
+ "shell.execute_reply": "2023-02-28T09:01:44.634598Z",
180
+ "shell.execute_reply.started": "2023-02-28T09:01:44.623294Z"
181
+ }
182
+ },
183
+ "outputs": [],
184
+ "source": [
185
+ "df['review']"
186
+ ]
187
+ },
188
+ {
189
+ "cell_type": "markdown",
190
+ "metadata": {},
191
+ "source": [
192
+ "### - Lowercasing all the Data"
193
+ ]
194
+ },
195
+ {
196
+ "cell_type": "code",
197
+ "execution_count": 4,
198
+ "metadata": {
199
+ "execution": {
200
+ "iopub.execute_input": "2023-02-28T09:01:46.978097Z",
201
+ "iopub.status.busy": "2023-02-28T09:01:46.977348Z",
202
+ "iopub.status.idle": "2023-02-28T09:01:47.121675Z",
203
+ "shell.execute_reply": "2023-02-28T09:01:47.120539Z",
204
+ "shell.execute_reply.started": "2023-02-28T09:01:46.978052Z"
205
+ }
206
+ },
207
+ "outputs": [],
208
+ "source": [
209
+ "# Apply all the preprocessing techniques\n",
210
+ "\n",
211
+ "# Convert all the text to lowercase\n",
212
+ "df['review'] = df['review'].str.lower()"
213
+ ]
214
+ },
215
+ {
216
+ "cell_type": "markdown",
217
+ "metadata": {},
218
+ "source": [
219
+ "### - Removeing HTML tags from Data"
220
+ ]
221
+ },
222
+ {
223
+ "cell_type": "code",
224
+ "execution_count": 5,
225
+ "metadata": {
226
+ "execution": {
227
+ "iopub.execute_input": "2023-02-28T09:01:49.177674Z",
228
+ "iopub.status.busy": "2023-02-28T09:01:49.176927Z",
229
+ "iopub.status.idle": "2023-02-28T09:01:49.395393Z",
230
+ "shell.execute_reply": "2023-02-28T09:01:49.394319Z",
231
+ "shell.execute_reply.started": "2023-02-28T09:01:49.177633Z"
232
+ }
233
+ },
234
+ "outputs": [],
235
+ "source": [
236
+ "# Removing HTML Tags\n",
237
+ "def remove_html_tags(text):\n",
238
+ " clean = re.compile('<.*?>')\n",
239
+ " return re.sub(clean, '', text)\n",
240
+ "\n",
241
+ "df['review'] = df['review'].apply(remove_html_tags)"
242
+ ]
243
+ },
244
+ {
245
+ "cell_type": "markdown",
246
+ "metadata": {},
247
+ "source": [
248
+ "### - Removing URLs from Texts"
249
+ ]
250
+ },
251
+ {
252
+ "cell_type": "code",
253
+ "execution_count": 6,
254
+ "metadata": {
255
+ "execution": {
256
+ "iopub.execute_input": "2023-02-28T09:01:52.159195Z",
257
+ "iopub.status.busy": "2023-02-28T09:01:52.158402Z",
258
+ "iopub.status.idle": "2023-02-28T09:01:52.674649Z",
259
+ "shell.execute_reply": "2023-02-28T09:01:52.673548Z",
260
+ "shell.execute_reply.started": "2023-02-28T09:01:52.159151Z"
261
+ }
262
+ },
263
+ "outputs": [],
264
+ "source": [
265
+ "# Removing URLs from Texts\n",
266
+ "def remove_urls(text):\n",
267
+ " clean = re.compile(r'http\\S+|www.\\S+')\n",
268
+ " return re.sub(clean, '', text)\n",
269
+ "\n",
270
+ "df['review'] = df['review'].apply(remove_urls)"
271
+ ]
272
+ },
273
+ {
274
+ "cell_type": "markdown",
275
+ "metadata": {},
276
+ "source": [
277
+ "### - Removing Punctuations from Data"
278
+ ]
279
+ },
280
+ {
281
+ "cell_type": "code",
282
+ "execution_count": 7,
283
+ "metadata": {
284
+ "execution": {
285
+ "iopub.execute_input": "2023-02-28T09:01:54.689274Z",
286
+ "iopub.status.busy": "2023-02-28T09:01:54.687886Z",
287
+ "iopub.status.idle": "2023-02-28T09:01:55.752957Z",
288
+ "shell.execute_reply": "2023-02-28T09:01:55.751887Z",
289
+ "shell.execute_reply.started": "2023-02-28T09:01:54.689212Z"
290
+ }
291
+ },
292
+ "outputs": [],
293
+ "source": [
294
+ "import string\n",
295
+ "exclude = string.punctuation\n",
296
+ "\n",
297
+ "# Remove punctuation \n",
298
+ "def remove_punc(text):\n",
299
+ " return text.translate(str.maketrans('','',exclude))\n",
300
+ "\n",
301
+ "df['review'] = df['review'].apply(remove_punc) "
302
+ ]
303
+ },
304
+ {
305
+ "cell_type": "markdown",
306
+ "metadata": {},
307
+ "source": [
308
+ "### - Chart word treatments(short form sms_slangs)"
309
+ ]
310
+ },
311
+ {
312
+ "cell_type": "code",
313
+ "execution_count": null,
314
+ "metadata": {
315
+ "execution": {
316
+ "iopub.execute_input": "2023-02-28T09:01:58.088137Z",
317
+ "iopub.status.busy": "2023-02-28T09:01:58.087588Z",
318
+ "iopub.status.idle": "2023-02-28T09:01:58.102145Z",
319
+ "shell.execute_reply": "2023-02-28T09:01:58.100570Z",
320
+ "shell.execute_reply.started": "2023-02-28T09:01:58.088094Z"
321
+ }
322
+ },
323
+ "outputs": [],
324
+ "source": [
325
+ "chart_words = {\"AFAIK\":\"As Far As I Know\",\n",
326
+ "'AFK':'Away From Keyboard',\n",
327
+ "'ASAP':'As Soon As Possible',\n",
328
+ "'ATK':'At The Keyboard',\n",
329
+ "'ATM':'At The Moment',\n",
330
+ "'A3':'Anytime, Anywhere, Anyplace',\n",
331
+ "'BAK':'Back At Keyboard',\n",
332
+ "'BBL':'Be Back Later',\n",
333
+ "'BBS':'Be Back Soon',\n",
334
+ "'BFN':'Bye For Now',\n",
335
+ "'B4N':'Bye For Now',\n",
336
+ "'BRB':'Be Right Back',\n",
337
+ "'BRT':'Be Right There',\n",
338
+ "'BTW':'By The Way',\n",
339
+ "'B4':'Before',\n",
340
+ "'B4N':'Bye For Now',\n",
341
+ "'CU':'See You',\n",
342
+ "'CUL8R':'See You Later',\n",
343
+ "'CYA':'See You',\n",
344
+ "'FAQ':'Frequently Asked Questions',\n",
345
+ "'FC':'Fingers Crossed',\n",
346
+ "\"FWIW\":\"For What It's Worth\",\n",
347
+ "\"FYI\":\"For Your Information\",\n",
348
+ "\"GAL\":\"Get A Life\",\n",
349
+ "\"GG\":\"Good Game\",\n",
350
+ "\"GN\":\"Good Night\",\n",
351
+ "\"GMTA\":\"Great Minds Think Alike\",\n",
352
+ "\"GR8\":\"Great\",\n",
353
+ "\"G9\":\"Genius\",\n",
354
+ "\"IC\":\"I See\",\n",
355
+ "\"ICQ\":\"I Seek you\",\n",
356
+ "\"ILU\":\"I Love You\",\n",
357
+ "\"IMHO\":\"In My Honest/Humble Opinion\",\n",
358
+ "\"IMO\":\"In My Opinion\",\n",
359
+ "\"IOW\":\"In Other Words\",\n",
360
+ "\"IRL\":\"In Real Life\",\n",
361
+ "\"KISS\":\"Keep It Simple Stupid\",\n",
362
+ "\"LDR\":\"Long Distance Relationship\",\n",
363
+ "\"LMAO\":\"Laugh My A Off\",\n",
364
+ "\"LOL\":\"Laughing Out Loud\",\n",
365
+ "\"LTNS\":\"Long Time No See\",\n",
366
+ "\"L8R\":\"Later\",\n",
367
+ "\"MTE\":\"My Thoughts Exactly\",\n",
368
+ "\"M8\":\"Mate\",\n",
369
+ "\"NRN\":\"No Reply Necessary\",\n",
370
+ "\"OIC\":\"Oh I See\",\n",
371
+ "\"PITA\":\"Pain In The A\",\n",
372
+ "\"PRT\":\"Party\",\n",
373
+ "\"PRW\":\"Parents Are Watching\",\n",
374
+ "\"QPSA\":\"Que Pasa?\",\n",
375
+ "\"ROFL\":\"Rolling On The Floor Laughing\",\n",
376
+ "\"ROFLOL\":\"Rolling On The Floor Laughing Out Loud\",\n",
377
+ "\"ROTFLMAO\":\"Rolling On The Floor Laughing My A Off\",\n",
378
+ "\"SK8\":\"Skate\",\n",
379
+ "\"STATS\":\"Your sex and age\",\n",
380
+ "\"ASL\":\"Age, Sex, Location\",\n",
381
+ "\"THX\":\"Thank You\",\n",
382
+ "\"TTFN\":\"Ta-Ta For Now\",\n",
383
+ "\"TTYL\":\"Talk To You Later\",\n",
384
+ "\"U\":\"You\",\n",
385
+ "\"U2\":\"You Too\",\n",
386
+ "\"U4E\":\"Yours For Ever\",\n",
387
+ "\"WB\":\"Welcome Back\",\n",
388
+ "\"WTF\":\"What The F\",\n",
389
+ "\"WTG\":\"Way To Go\",\n",
390
+ "\"WUF\":\"Where Are You From\",\n",
391
+ "'W8':'Wait',\n",
392
+ "'7K':'Sick D Laugher'}"
393
+ ]
394
+ },
395
+ {
396
+ "cell_type": "code",
397
+ "execution_count": null,
398
+ "metadata": {
399
+ "execution": {
400
+ "iopub.execute_input": "2023-02-28T09:01:59.138690Z",
401
+ "iopub.status.busy": "2023-02-28T09:01:59.138079Z",
402
+ "iopub.status.idle": "2023-02-28T09:01:59.148390Z",
403
+ "shell.execute_reply": "2023-02-28T09:01:59.147289Z",
404
+ "shell.execute_reply.started": "2023-02-28T09:01:59.138632Z"
405
+ }
406
+ },
407
+ "outputs": [],
408
+ "source": [
409
+ "def chart_conversations(text):\n",
410
+ " new_text = []\n",
411
+ " for w in text.split():\n",
412
+ " if w.upper() in chart_words:\n",
413
+ " new_text.append(chart_words[w.upper()])\n",
414
+ " else:\n",
415
+ " new_text.append(w)\n",
416
+ " return \" \".join(new_text)"
417
+ ]
418
+ },
419
+ {
420
+ "cell_type": "code",
421
+ "execution_count": null,
422
+ "metadata": {
423
+ "execution": {
424
+ "iopub.execute_input": "2023-02-28T09:02:01.222894Z",
425
+ "iopub.status.busy": "2023-02-28T09:02:01.221976Z",
426
+ "iopub.status.idle": "2023-02-28T09:02:01.230050Z",
427
+ "shell.execute_reply": "2023-02-28T09:02:01.228866Z",
428
+ "shell.execute_reply.started": "2023-02-28T09:02:01.222848Z"
429
+ }
430
+ },
431
+ "outputs": [],
432
+ "source": [
433
+ "nm = \"Hello , WUF , CUL8R , FAQ , BBL\"\n",
434
+ "chart_conversations(nm)"
435
+ ]
436
+ },
437
+ {
438
+ "cell_type": "markdown",
439
+ "metadata": {},
440
+ "source": [
441
+ "### - Spelling Correction:(spcy, textbolb, pyspellchecker)"
442
+ ]
443
+ },
444
+ {
445
+ "cell_type": "code",
446
+ "execution_count": null,
447
+ "metadata": {
448
+ "execution": {
449
+ "iopub.execute_input": "2023-02-28T09:02:05.938121Z",
450
+ "iopub.status.busy": "2023-02-28T09:02:05.936910Z",
451
+ "iopub.status.idle": "2023-02-28T09:02:06.457439Z",
452
+ "shell.execute_reply": "2023-02-28T09:02:06.456315Z",
453
+ "shell.execute_reply.started": "2023-02-28T09:02:05.938064Z"
454
+ }
455
+ },
456
+ "outputs": [],
457
+ "source": [
458
+ "from textblob import TextBlob"
459
+ ]
460
+ },
461
+ {
462
+ "cell_type": "code",
463
+ "execution_count": null,
464
+ "metadata": {
465
+ "execution": {
466
+ "iopub.execute_input": "2023-02-28T09:02:08.338208Z",
467
+ "iopub.status.busy": "2023-02-28T09:02:08.337106Z",
468
+ "iopub.status.idle": "2023-02-28T09:02:09.128963Z",
469
+ "shell.execute_reply": "2023-02-28T09:02:09.127873Z",
470
+ "shell.execute_reply.started": "2023-02-28T09:02:08.338165Z"
471
+ }
472
+ },
473
+ "outputs": [],
474
+ "source": [
475
+ "incorrect_text = \"certain conditions several ggenaeration ,read the notebook and alos like notboook\"\n",
476
+ "\n",
477
+ "# Spelling correction by Textblob\n",
478
+ "textBlob = TextBlob(incorrect_text)\n",
479
+ "textBlob.correct().string"
480
+ ]
481
+ },
482
+ {
483
+ "cell_type": "markdown",
484
+ "metadata": {},
485
+ "source": [
486
+ "### - Removing Stopwords\n",
487
+ "for POS - tagging we don't use stopword to remove is,am,are,was,and,but..."
488
+ ]
489
+ },
490
+ {
491
+ "cell_type": "code",
492
+ "execution_count": 8,
493
+ "metadata": {
494
+ "execution": {
495
+ "iopub.execute_input": "2023-02-28T09:02:12.057700Z",
496
+ "iopub.status.busy": "2023-02-28T09:02:12.057305Z",
497
+ "iopub.status.idle": "2023-02-28T09:02:12.070805Z",
498
+ "shell.execute_reply": "2023-02-28T09:02:12.068811Z",
499
+ "shell.execute_reply.started": "2023-02-28T09:02:12.057663Z"
500
+ }
501
+ },
502
+ "outputs": [
503
+ {
504
+ "data": {
505
+ "text/plain": [
506
+ "\"nltk.download('stopwords')\""
507
+ ]
508
+ },
509
+ "execution_count": 8,
510
+ "metadata": {},
511
+ "output_type": "execute_result"
512
+ }
513
+ ],
514
+ "source": [
515
+ "# Import the library and download the stop words:\n",
516
+ "from nltk.corpus import stopwords\n",
517
+ "stp = stopwords.words('english')\n",
518
+ "\n",
519
+ "# Other method if nltk stop words not present\n",
520
+ "'''nltk.download('stopwords')'''"
521
+ ]
522
+ },
523
+ {
524
+ "cell_type": "code",
525
+ "execution_count": 9,
526
+ "metadata": {
527
+ "execution": {
528
+ "iopub.execute_input": "2023-02-28T09:02:14.667306Z",
529
+ "iopub.status.busy": "2023-02-28T09:02:14.666909Z",
530
+ "iopub.status.idle": "2023-02-28T09:02:14.673664Z",
531
+ "shell.execute_reply": "2023-02-28T09:02:14.672527Z",
532
+ "shell.execute_reply.started": "2023-02-28T09:02:14.667267Z"
533
+ }
534
+ },
535
+ "outputs": [],
536
+ "source": [
537
+ "# Define a function to remove stop words from the text:\n",
538
+ "def remove_stopwords(text):\n",
539
+ " new_text = []\n",
540
+ " \n",
541
+ " for word in text.split():\n",
542
+ " if word in stp: # stp = stopwords.words('english')\n",
543
+ " new_text.append('')\n",
544
+ " else:\n",
545
+ " new_text.append(word)\n",
546
+ " \n",
547
+ " x = new_text[:]\n",
548
+ " new_text.clear()\n",
549
+ " return \" \".join(x)"
550
+ ]
551
+ },
552
+ {
553
+ "cell_type": "code",
554
+ "execution_count": 10,
555
+ "metadata": {
556
+ "execution": {
557
+ "iopub.execute_input": "2023-02-28T09:02:16.297289Z",
558
+ "iopub.status.busy": "2023-02-28T09:02:16.296887Z",
559
+ "iopub.status.idle": "2023-02-28T09:02:39.152572Z",
560
+ "shell.execute_reply": "2023-02-28T09:02:39.151496Z",
561
+ "shell.execute_reply.started": "2023-02-28T09:02:16.297251Z"
562
+ }
563
+ },
564
+ "outputs": [],
565
+ "source": [
566
+ "df['review'] = df['review'].apply(remove_stopwords)"
567
+ ]
568
+ },
569
+ {
570
+ "cell_type": "markdown",
571
+ "metadata": {},
572
+ "source": [
573
+ "### - Handling Emoji\n",
574
+ "- **Replace with meaning** -\n",
575
+ "We can remove all emojis from the text using regular expressions\n",
576
+ "- **Remove** -\n",
577
+ "We can replace emojis with a text representation."
578
+ ]
579
+ },
580
+ {
581
+ "cell_type": "code",
582
+ "execution_count": 11,
583
+ "metadata": {
584
+ "execution": {
585
+ "iopub.execute_input": "2023-02-28T09:02:43.119351Z",
586
+ "iopub.status.busy": "2023-02-28T09:02:43.118942Z",
587
+ "iopub.status.idle": "2023-02-28T09:02:43.125800Z",
588
+ "shell.execute_reply": "2023-02-28T09:02:43.124522Z",
589
+ "shell.execute_reply.started": "2023-02-28T09:02:43.119314Z"
590
+ }
591
+ },
592
+ "outputs": [],
593
+ "source": [
594
+ "# Remove by usning Regular expression\n",
595
+ "def remove_emoji(text):\n",
596
+ " emoji_pattern = re.compile(\"[\"\n",
597
+ " u\"\\U0001F600-\\U0001F64F\" # emoticons\n",
598
+ " u\"\\U0001F300-\\U0001F5FF\" # symbols & pictographs\n",
599
+ " u\"\\U0001F680-\\U0001F6FF\" # transport & map symbols\n",
600
+ " u\"\\U0001F1E0-\\U0001F1FF\" # flags (iOS)\n",
601
+ " \"]+\", flags=re.UNICODE)\n",
602
+ " return emoji_pattern.sub(r'', text)"
603
+ ]
604
+ },
605
+ {
606
+ "cell_type": "code",
607
+ "execution_count": 12,
608
+ "metadata": {
609
+ "execution": {
610
+ "iopub.execute_input": "2023-02-28T09:02:45.558806Z",
611
+ "iopub.status.busy": "2023-02-28T09:02:45.557737Z",
612
+ "iopub.status.idle": "2023-02-28T09:02:45.568747Z",
613
+ "shell.execute_reply": "2023-02-28T09:02:45.567353Z",
614
+ "shell.execute_reply.started": "2023-02-28T09:02:45.558761Z"
615
+ }
616
+ },
617
+ "outputs": [
618
+ {
619
+ "data": {
620
+ "text/plain": [
621
+ "'hello, world ,, '"
622
+ ]
623
+ },
624
+ "execution_count": 12,
625
+ "metadata": {},
626
+ "output_type": "execute_result"
627
+ }
628
+ ],
629
+ "source": [
630
+ "emoji_text = \"hello, world 😀,😃,😄 😈 😀\"\n",
631
+ "remove_emoji(emoji_text)"
632
+ ]
633
+ },
634
+ {
635
+ "cell_type": "code",
636
+ "execution_count": null,
637
+ "metadata": {
638
+ "execution": {
639
+ "iopub.execute_input": "2023-02-28T09:02:48.839342Z",
640
+ "iopub.status.busy": "2023-02-28T09:02:48.838411Z",
641
+ "iopub.status.idle": "2023-02-28T09:02:59.528188Z",
642
+ "shell.execute_reply": "2023-02-28T09:02:59.526961Z",
643
+ "shell.execute_reply.started": "2023-02-28T09:02:48.839294Z"
644
+ }
645
+ },
646
+ "outputs": [],
647
+ "source": [
648
+ "!pip install emoji"
649
+ ]
650
+ },
651
+ {
652
+ "cell_type": "code",
653
+ "execution_count": null,
654
+ "metadata": {
655
+ "execution": {
656
+ "iopub.execute_input": "2023-02-28T09:03:01.798077Z",
657
+ "iopub.status.busy": "2023-02-28T09:03:01.797654Z",
658
+ "iopub.status.idle": "2023-02-28T09:03:01.833902Z",
659
+ "shell.execute_reply": "2023-02-28T09:03:01.832698Z",
660
+ "shell.execute_reply.started": "2023-02-28T09:03:01.798028Z"
661
+ }
662
+ },
663
+ "outputs": [],
664
+ "source": [
665
+ "# Replacing emoji to text\n",
666
+ "import emoji\n",
667
+ "\n",
668
+ "print(emoji.demojize(\"hello, world 😀,😃,😄 😈 😀\"))"
669
+ ]
670
+ },
671
+ {
672
+ "cell_type": "markdown",
673
+ "metadata": {},
674
+ "source": [
675
+ "### - Tokenizations :\n",
676
+ "**- Word Tokenization**\n",
677
+ "\n",
678
+ "**- Sentence Tokenization**\n",
679
+ "\n",
680
+ "**White space tokenization:** This method splits a text into tokens based on the white space characters (e.g., spaces, tabs, newlines) between them. This is the simplest form of tokenization and can be implemented using the split() function in Python.\n",
681
+ "\n",
682
+ "**Punctuation-based tokenization:** This method splits a text into tokens based on the punctuation marks between them. This method is more complex than white space tokenization and can be implemented using regular expressions or the nltk library in Python.\n",
683
+ "\n",
684
+ "**Word-based tokenization:** This method splits a text into tokens based on the words between them. This method is more complex than white space tokenization and requires a language model that can identify the boundaries between words. The nltk library provides several pre-trained models for word-based tokenization, including the punkt model."
685
+ ]
686
+ },
687
+ {
688
+ "cell_type": "code",
689
+ "execution_count": null,
690
+ "metadata": {
691
+ "execution": {
692
+ "iopub.execute_input": "2023-02-28T09:03:07.908166Z",
693
+ "iopub.status.busy": "2023-02-28T09:03:07.907155Z",
694
+ "iopub.status.idle": "2023-02-28T09:03:07.913903Z",
695
+ "shell.execute_reply": "2023-02-28T09:03:07.912592Z",
696
+ "shell.execute_reply.started": "2023-02-28T09:03:07.908110Z"
697
+ }
698
+ },
699
+ "outputs": [],
700
+ "source": [
701
+ "sent_1 = \"This method splits by sentences. This tokenization implemented\"\n",
702
+ "sent_2 = \"This method splits by word.This tokenization implemented\"\n",
703
+ "\n",
704
+ "# By Using NLTK\n",
705
+ "from nltk.tokenize import word_tokenize ,sent_tokenize"
706
+ ]
707
+ },
708
+ {
709
+ "cell_type": "code",
710
+ "execution_count": null,
711
+ "metadata": {
712
+ "execution": {
713
+ "iopub.execute_input": "2023-02-28T09:03:10.058110Z",
714
+ "iopub.status.busy": "2023-02-28T09:03:10.057093Z",
715
+ "iopub.status.idle": "2023-02-28T09:03:10.079265Z",
716
+ "shell.execute_reply": "2023-02-28T09:03:10.078026Z",
717
+ "shell.execute_reply.started": "2023-02-28T09:03:10.058047Z"
718
+ }
719
+ },
720
+ "outputs": [],
721
+ "source": [
722
+ "print('sentence_tokenize -',sent_tokenize(sent_1))\n",
723
+ "print('word_tokenize -',word_tokenize(sent_2))"
724
+ ]
725
+ },
726
+ {
727
+ "cell_type": "code",
728
+ "execution_count": null,
729
+ "metadata": {
730
+ "execution": {
731
+ "iopub.execute_input": "2023-02-28T09:03:12.943338Z",
732
+ "iopub.status.busy": "2023-02-28T09:03:12.942087Z",
733
+ "iopub.status.idle": "2023-02-28T09:03:36.465661Z",
734
+ "shell.execute_reply": "2023-02-28T09:03:36.464382Z",
735
+ "shell.execute_reply.started": "2023-02-28T09:03:12.943284Z"
736
+ }
737
+ },
738
+ "outputs": [],
739
+ "source": [
740
+ "# By Using Spacy\n",
741
+ "import spacy\n",
742
+ "nlp = spacy.load('en_core_web_sm')\n",
743
+ "\n",
744
+ "doc1 = nlp(sent_1)\n",
745
+ "doc2 = nlp(sent_2)\n",
746
+ "\n",
747
+ "sent1 = []\n",
748
+ "sent2 = []\n",
749
+ "for token in doc1:\n",
750
+ " sent1.append(token)\n",
751
+ "for token in doc2:\n",
752
+ " sent2.append(token)\n",
753
+ "print('sent_1 tokenize',sent1)\n",
754
+ "print('sent_2 tokenize',sent2)"
755
+ ]
756
+ },
757
+ {
758
+ "cell_type": "code",
759
+ "execution_count": 13,
760
+ "metadata": {
761
+ "execution": {
762
+ "iopub.execute_input": "2023-02-28T09:03:36.468767Z",
763
+ "iopub.status.busy": "2023-02-28T09:03:36.467757Z",
764
+ "iopub.status.idle": "2023-02-28T09:04:05.529030Z",
765
+ "shell.execute_reply": "2023-02-28T09:04:05.527967Z",
766
+ "shell.execute_reply.started": "2023-02-28T09:03:36.468723Z"
767
+ }
768
+ },
769
+ "outputs": [],
770
+ "source": [
771
+ "# Apply nltk word_tokenize in imdb data\n",
772
+ "from nltk.tokenize import word_tokenize\n",
773
+ "def wrd_token(text):\n",
774
+ " return word_tokenize(text)\n",
775
+ "df['review'] = df['review'].apply(wrd_token)"
776
+ ]
777
+ },
778
+ {
779
+ "cell_type": "markdown",
780
+ "metadata": {},
781
+ "source": [
782
+ "### - Stemming :(It is slow in processing)\n"
783
+ ]
784
+ },
785
+ {
786
+ "cell_type": "code",
787
+ "execution_count": null,
788
+ "metadata": {
789
+ "execution": {
790
+ "iopub.execute_input": "2023-02-28T09:04:35.737577Z",
791
+ "iopub.status.busy": "2023-02-28T09:04:35.736859Z",
792
+ "iopub.status.idle": "2023-02-28T09:04:35.743182Z",
793
+ "shell.execute_reply": "2023-02-28T09:04:35.741453Z",
794
+ "shell.execute_reply.started": "2023-02-28T09:04:35.737534Z"
795
+ }
796
+ },
797
+ "outputs": [],
798
+ "source": [
799
+ "from nltk.stem.porter import PorterStemmer\n",
800
+ "ps = PorterStemmer()"
801
+ ]
802
+ },
803
+ {
804
+ "cell_type": "code",
805
+ "execution_count": null,
806
+ "metadata": {
807
+ "execution": {
808
+ "iopub.execute_input": "2023-02-28T09:04:46.312604Z",
809
+ "iopub.status.busy": "2023-02-28T09:04:46.311973Z",
810
+ "iopub.status.idle": "2023-02-28T09:07:17.076444Z",
811
+ "shell.execute_reply": "2023-02-28T09:07:17.075197Z",
812
+ "shell.execute_reply.started": "2023-02-28T09:04:46.312561Z"
813
+ }
814
+ },
815
+ "outputs": [],
816
+ "source": [
817
+ "# Function for applying stemming function\n",
818
+ "def stem_words(text):\n",
819
+ " return \" \".join([ps.stem(word) for word in text])\n",
820
+ "\n",
821
+ "df['review'].apply(stem_words)"
822
+ ]
823
+ },
824
+ {
825
+ "cell_type": "markdown",
826
+ "metadata": {},
827
+ "source": [
828
+ "### - Lemmatization :\n"
829
+ ]
830
+ },
831
+ {
832
+ "cell_type": "code",
833
+ "execution_count": null,
834
+ "metadata": {
835
+ "execution": {
836
+ "iopub.execute_input": "2023-02-28T09:12:05.953498Z",
837
+ "iopub.status.busy": "2023-02-28T09:12:05.952776Z",
838
+ "iopub.status.idle": "2023-02-28T09:12:12.682133Z",
839
+ "shell.execute_reply": "2023-02-28T09:12:12.679291Z",
840
+ "shell.execute_reply.started": "2023-02-28T09:12:05.953435Z"
841
+ }
842
+ },
843
+ "outputs": [],
844
+ "source": [
845
+ "import nltk\n",
846
+ "from nltk.stem import WordNetLemmatizer\n",
847
+ "nltk.download() \n",
848
+ "lemmatizer = WordNetLemmatizer()\n",
849
+ "\n",
850
+ "def lemma_words(text):\n",
851
+ " return \" \".join([lemmatizer.lemmatize(word) for word in text])"
852
+ ]
853
+ },
854
+ {
855
+ "cell_type": "code",
856
+ "execution_count": null,
857
+ "metadata": {
858
+ "execution": {
859
+ "iopub.execute_input": "2023-02-28T09:12:39.848502Z",
860
+ "iopub.status.busy": "2023-02-28T09:12:39.847845Z",
861
+ "iopub.status.idle": "2023-02-28T09:15:17.653995Z",
862
+ "shell.execute_reply": "2023-02-28T09:15:17.652811Z",
863
+ "shell.execute_reply.started": "2023-02-28T09:12:39.848457Z"
864
+ }
865
+ },
866
+ "outputs": [],
867
+ "source": [
868
+ "df['lemma_review'] = df['review'].apply(stem_words)"
869
+ ]
870
+ },
871
+ {
872
+ "cell_type": "code",
873
+ "execution_count": null,
874
+ "metadata": {
875
+ "execution": {
876
+ "iopub.execute_input": "2023-02-28T09:09:25.548239Z",
877
+ "iopub.status.busy": "2023-02-28T09:09:25.547782Z",
878
+ "iopub.status.idle": "2023-02-28T09:09:25.595610Z",
879
+ "shell.execute_reply": "2023-02-28T09:09:25.594356Z",
880
+ "shell.execute_reply.started": "2023-02-28T09:09:25.548199Z"
881
+ }
882
+ },
883
+ "outputs": [],
884
+ "source": [
885
+ "# Total number of words in corpus and number of unique word.\n",
886
+ "merge_list = []\n",
887
+ "for row in df['review'][0:5000]:\n",
888
+ " merge_list.extend(row)\n",
889
+ "print('No. of word in corpus - ',len(merge_list))\n",
890
+ "print('No. of unique word in corpus - ',len(set(merge_list)))"
891
+ ]
892
+ },
893
+ {
894
+ "cell_type": "markdown",
895
+ "metadata": {},
896
+ "source": [
897
+ "## 2. Text Representations Or Text Vectorization:\n",
898
+ "\n",
899
+ "### - Bag of word (Text classification)\n",
900
+ "\n"
901
+ ]
902
+ },
903
+ {
904
+ "cell_type": "code",
905
+ "execution_count": null,
906
+ "metadata": {
907
+ "execution": {
908
+ "iopub.execute_input": "2023-02-28T08:59:46.519000Z",
909
+ "iopub.status.busy": "2023-02-28T08:59:46.516506Z",
910
+ "iopub.status.idle": "2023-02-28T08:59:51.295200Z",
911
+ "shell.execute_reply": "2023-02-28T08:59:51.294131Z",
912
+ "shell.execute_reply.started": "2023-02-28T08:59:46.518957Z"
913
+ }
914
+ },
915
+ "outputs": [],
916
+ "source": [
917
+ "from sklearn.feature_extraction.text import CountVectorizer\n",
918
+ "cv = CountVectorizer()\n",
919
+ "bow = cv.fit_transform(df['lemma_review'])"
920
+ ]
921
+ },
922
+ {
923
+ "cell_type": "code",
924
+ "execution_count": null,
925
+ "metadata": {
926
+ "execution": {
927
+ "iopub.execute_input": "2023-02-28T08:59:51.301302Z",
928
+ "iopub.status.busy": "2023-02-28T08:59:51.300748Z"
929
+ }
930
+ },
931
+ "outputs": [],
932
+ "source": [
933
+ "bow.toarray()"
934
+ ]
935
+ },
936
+ {
937
+ "cell_type": "markdown",
938
+ "metadata": {},
939
+ "source": [
940
+ "### - N-Grams or Bag of Ngrams\n",
941
+ "\n",
942
+ "Dimension increase with increase in ngrams, It slows down the Algorithim and out of vocabulary ignored."
943
+ ]
944
+ },
945
+ {
946
+ "cell_type": "code",
947
+ "execution_count": null,
948
+ "metadata": {
949
+ "execution": {
950
+ "iopub.execute_input": "2023-02-28T09:00:17.147997Z",
951
+ "iopub.status.busy": "2023-02-28T09:00:17.147340Z",
952
+ "iopub.status.idle": "2023-02-28T09:00:18.009694Z",
953
+ "shell.execute_reply": "2023-02-28T09:00:18.008034Z",
954
+ "shell.execute_reply.started": "2023-02-28T09:00:17.147955Z"
955
+ }
956
+ },
957
+ "outputs": [],
958
+ "source": [
959
+ "from sklearn.feature_extraction.text import CountVectorizer\n",
960
+ "cv_1 = CountVectorizer(ngram_range=(10,10))\n",
961
+ "bow2 = cv_1.fit_transform(df['lemma_review'])"
962
+ ]
963
+ },
964
+ {
965
+ "cell_type": "code",
966
+ "execution_count": null,
967
+ "metadata": {},
968
+ "outputs": [],
969
+ "source": [
970
+ "bow2.toarray()"
971
+ ]
972
+ },
973
+ {
974
+ "cell_type": "markdown",
975
+ "metadata": {},
976
+ "source": [
977
+ "### - Tf - idf (Term frequency and Inverse Document frequency)\n",
978
+ "\n",
979
+ "There sparcity present and out of vocabulary ignore, Dimension large if vocabulary large and symantic relationship not capture."
980
+ ]
981
+ },
982
+ {
983
+ "cell_type": "code",
984
+ "execution_count": null,
985
+ "metadata": {
986
+ "execution": {
987
+ "iopub.execute_input": "2023-02-28T09:17:00.313046Z",
988
+ "iopub.status.busy": "2023-02-28T09:17:00.312563Z",
989
+ "iopub.status.idle": "2023-02-28T09:17:01.216547Z",
990
+ "shell.execute_reply": "2023-02-28T09:17:01.214914Z",
991
+ "shell.execute_reply.started": "2023-02-28T09:17:00.313002Z"
992
+ }
993
+ },
994
+ "outputs": [],
995
+ "source": [
996
+ "from sklearn.feature_extraction.text import TfidfVectorizer\n",
997
+ "tfidf = TfidfVectorizer()\n",
998
+ "tf_idf = tfidf.fit_transform(df['lemma_review'])"
999
+ ]
1000
+ },
1001
+ {
1002
+ "cell_type": "code",
1003
+ "execution_count": 14,
1004
+ "metadata": {
1005
+ "execution": {
1006
+ "iopub.execute_input": "2023-02-28T09:16:54.789060Z",
1007
+ "iopub.status.busy": "2023-02-28T09:16:54.787898Z",
1008
+ "iopub.status.idle": "2023-02-28T09:16:54.868566Z",
1009
+ "shell.execute_reply": "2023-02-28T09:16:54.866662Z",
1010
+ "shell.execute_reply.started": "2023-02-28T09:16:54.789007Z"
1011
+ }
1012
+ },
1013
+ "outputs": [
1014
+ {
1015
+ "ename": "NameError",
1016
+ "evalue": "name 'tf_idf' is not defined",
1017
+ "output_type": "error",
1018
+ "traceback": [
1019
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
1020
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
1021
+ "\u001b[0;32m<ipython-input-14-3425eba7af87>\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mtf_idf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtoarray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
1022
+ "\u001b[0;31mNameError\u001b[0m: name 'tf_idf' is not defined"
1023
+ ]
1024
+ }
1025
+ ],
1026
+ "source": [
1027
+ "tf_idf.toarray()"
1028
+ ]
1029
+ },
1030
+ {
1031
+ "cell_type": "code",
1032
+ "execution_count": null,
1033
+ "metadata": {},
1034
+ "outputs": [],
1035
+ "source": []
1036
+ },
1037
+ {
1038
+ "cell_type": "code",
1039
+ "execution_count": null,
1040
+ "metadata": {},
1041
+ "outputs": [],
1042
+ "source": []
1043
+ },
1044
+ {
1045
+ "cell_type": "code",
1046
+ "execution_count": null,
1047
+ "metadata": {},
1048
+ "outputs": [],
1049
+ "source": []
1050
+ },
1051
+ {
1052
+ "cell_type": "code",
1053
+ "execution_count": null,
1054
+ "metadata": {},
1055
+ "outputs": [],
1056
+ "source": []
1057
+ },
1058
+ {
1059
+ "cell_type": "code",
1060
+ "execution_count": null,
1061
+ "metadata": {},
1062
+ "outputs": [],
1063
+ "source": [
1064
+ "df['review'][0]"
1065
+ ]
1066
+ },
1067
+ {
1068
+ "cell_type": "code",
1069
+ "execution_count": null,
1070
+ "metadata": {},
1071
+ "outputs": [],
1072
+ "source": []
1073
+ }
1074
+ ],
1075
+ "metadata": {
1076
+ "kernelspec": {
1077
+ "display_name": "Python 3",
1078
+ "language": "python",
1079
+ "name": "python3"
1080
+ },
1081
+ "language_info": {
1082
+ "codemirror_mode": {
1083
+ "name": "ipython",
1084
+ "version": 3
1085
+ },
1086
+ "file_extension": ".py",
1087
+ "mimetype": "text/x-python",
1088
+ "name": "python",
1089
+ "nbconvert_exporter": "python",
1090
+ "pygments_lexer": "ipython3",
1091
+ "version": "3.10.12"
1092
+ }
1093
+ },
1094
+ "nbformat": 4,
1095
+ "nbformat_minor": 4
1096
+ }
benchmark/NBspecific_1/README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset Information
2
+
3
+
4
+
5
+ ## Dataset: IMDB Dataset of 50K Movie Reviews
6
+
7
+ **Source:**
8
+ - **Title:** IMDB Dataset of 50K Movie Reviews
9
+ - **URL:** [https://www.kaggle.com/datasets/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews](https://www.kaggle.com/datasets/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews)
10
+ - **Attribution:** Shared on Kaggle or other platform.
11
+
12
+ **License:**
13
+ - **License Type:** This dataset originated from a Kaggle competition and is available for academic use.
14
+ - **Summary:** Attribution and usage rules as specified by the dataset's license.
15
+
16
+
17
+
18
+ **How to Attribute:**
19
+ > "IMDB Dataset of 50K Movie Reviews". Available at https://www.kaggle.com/datasets/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews. This dataset originated from a Kaggle competition and is available for academic use.
20
+
21
+
22
+
{data → benchmark}/NBspecific_1/data/IMDB Dataset.csv RENAMED
File without changes
{data → benchmark}/NBspecific_10/NBspecific_10.ipynb RENAMED
File without changes
benchmark/NBspecific_10/NBspecific_10_fixed.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
benchmark/NBspecific_10/NBspecific_10_reproduced.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
benchmark/NBspecific_10/README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset Information
2
+
3
+
4
+
5
+ ## Dataset: Wind Power Forecasting
6
+
7
+ **Source:**
8
+ - **Title:** Wind Power Forecasting
9
+ - **URL:** [https://www.kaggle.com/datasets/theforcecoder/wind-power-forecasting](https://www.kaggle.com/datasets/theforcecoder/wind-power-forecasting)
10
+ - **Attribution:** Shared on Kaggle or other platform.
11
+
12
+ **License:**
13
+ - **License Type:** CC0: Public Domain
14
+ - **Summary:** Attribution and usage rules as specified by the dataset's license.
15
+
16
+
17
+
18
+ **How to Attribute:**
19
+ > "Wind Power Forecasting". Available at https://www.kaggle.com/datasets/theforcecoder/wind-power-forecasting. Licensed under CC0: Public Domain.
20
+
21
+
22
+
{data → benchmark}/NBspecific_10/data/Turbine_Data.csv RENAMED
File without changes
benchmark/NBspecific_11/NBspecific_11.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
benchmark/NBspecific_11/NBspecific_11_fixed.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
benchmark/NBspecific_11/NBspecific_11_reproduced.ipynb ADDED
@@ -0,0 +1,698 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {
7
+ "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
8
+ "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5"
9
+ },
10
+ "outputs": [],
11
+ "source": [
12
+ "# This Python 3 environment comes with many helpful analytics libraries installed\n",
13
+ "# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n",
14
+ "# For example, here's several helpful packages to load\n",
15
+ "\n",
16
+ "import numpy as np # linear algebra\n",
17
+ "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
18
+ "\n",
19
+ "# Input data files are available in the read-only \"../input/\" directory\n",
20
+ "# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n",
21
+ "\n",
22
+ "import os\n",
23
+ "for dirname, _, filenames in os.walk('/kaggle/input'):\n",
24
+ " for filename in filenames:\n",
25
+ " print(os.path.join(dirname, filename))\n",
26
+ "\n",
27
+ "# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n",
28
+ "# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "markdown",
33
+ "metadata": {},
34
+ "source": [
35
+ "## CW攻击算法Pytorch实现"
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "code",
40
+ "execution_count": 1,
41
+ "metadata": {
42
+ "execution": {
43
+ "iopub.execute_input": "2023-06-09T03:02:58.788999Z",
44
+ "iopub.status.busy": "2023-06-09T03:02:58.788307Z",
45
+ "iopub.status.idle": "2023-06-09T03:02:58.794449Z",
46
+ "shell.execute_reply": "2023-06-09T03:02:58.793461Z",
47
+ "shell.execute_reply.started": "2023-06-09T03:02:58.788965Z"
48
+ }
49
+ },
50
+ "outputs": [],
51
+ "source": [
52
+ "import torch\n",
53
+ "import torchvision\n",
54
+ "from torchvision import datasets,transforms\n",
55
+ "from torch.autograd import Variable\n",
56
+ "# from torch.autograd.gradcheck import \n",
57
+ "import torch.utils.data.dataloader as Data\n",
58
+ "import torch.nn as nn\n",
59
+ "from torchvision import models\n",
60
+ "import numpy as np\n",
61
+ "import matplotlib.pyplot as plt\n",
62
+ "import cv2"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "execution_count": null,
68
+ "metadata": {
69
+ "execution": {
70
+ "iopub.execute_input": "2023-06-09T01:57:59.268186Z",
71
+ "iopub.status.busy": "2023-06-09T01:57:59.267828Z",
72
+ "iopub.status.idle": "2023-06-09T02:07:04.393072Z",
73
+ "shell.execute_reply": "2023-06-09T02:07:04.391912Z",
74
+ "shell.execute_reply.started": "2023-06-09T01:57:59.268157Z"
75
+ }
76
+ },
77
+ "outputs": [],
78
+ "source": [
79
+ "!pip install d2l "
80
+ ]
81
+ },
82
+ {
83
+ "cell_type": "code",
84
+ "execution_count": null,
85
+ "metadata": {
86
+ "execution": {
87
+ "iopub.execute_input": "2023-06-09T02:08:24.830570Z",
88
+ "iopub.status.busy": "2023-06-09T02:08:24.830199Z",
89
+ "iopub.status.idle": "2023-06-09T02:08:24.863014Z",
90
+ "shell.execute_reply": "2023-06-09T02:08:24.862009Z",
91
+ "shell.execute_reply.started": "2023-06-09T02:08:24.830529Z"
92
+ }
93
+ },
94
+ "outputs": [],
95
+ "source": [
96
+ "from d2l import torch as d2l"
97
+ ]
98
+ },
99
+ {
100
+ "cell_type": "code",
101
+ "execution_count": 3,
102
+ "metadata": {
103
+ "execution": {
104
+ "iopub.execute_input": "2023-06-09T02:08:48.236386Z",
105
+ "iopub.status.busy": "2023-06-09T02:08:48.235994Z",
106
+ "iopub.status.idle": "2023-06-09T02:08:48.242104Z",
107
+ "shell.execute_reply": "2023-06-09T02:08:48.239889Z",
108
+ "shell.execute_reply.started": "2023-06-09T02:08:48.236354Z"
109
+ }
110
+ },
111
+ "outputs": [],
112
+ "source": [
113
+ "# device = d2l.try_gpu()\n",
114
+ "device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")"
115
+ ]
116
+ },
117
+ {
118
+ "cell_type": "code",
119
+ "execution_count": 4,
120
+ "metadata": {
121
+ "execution": {
122
+ "iopub.execute_input": "2023-06-09T02:10:11.562488Z",
123
+ "iopub.status.busy": "2023-06-09T02:10:11.562137Z",
124
+ "iopub.status.idle": "2023-06-09T02:10:11.619109Z",
125
+ "shell.execute_reply": "2023-06-09T02:10:11.617961Z",
126
+ "shell.execute_reply.started": "2023-06-09T02:10:11.562459Z"
127
+ }
128
+ },
129
+ "outputs": [
130
+ {
131
+ "name": "stdout",
132
+ "output_type": "stream",
133
+ "text": [
134
+ "(1, 3, 224, 224)\n"
135
+ ]
136
+ }
137
+ ],
138
+ "source": [
139
+ "image_path=\"data/cow.jpeg\"\n",
140
+ "orig = cv2.imread(image_path)[..., ::-1]\n",
141
+ "orig = cv2.resize(orig, (224, 224))\n",
142
+ "img = orig.copy().astype(np.float32)\n",
143
+ "\n",
144
+ "mean = [0.485, 0.456, 0.406]\n",
145
+ "std = [0.229, 0.224, 0.225]\n",
146
+ "img /= 255.0\n",
147
+ "img = (img - mean) / std\n",
148
+ "img = img.transpose(2, 0, 1)\n",
149
+ "\n",
150
+ "img=np.expand_dims(img, axis=0)\n",
151
+ "print(img.shape)"
152
+ ]
153
+ },
154
+ {
155
+ "cell_type": "code",
156
+ "execution_count": 5,
157
+ "metadata": {
158
+ "execution": {
159
+ "iopub.execute_input": "2023-06-09T02:11:40.531442Z",
160
+ "iopub.status.busy": "2023-06-09T02:11:40.530974Z",
161
+ "iopub.status.idle": "2023-06-09T02:11:45.929846Z",
162
+ "shell.execute_reply": "2023-06-09T02:11:45.928865Z",
163
+ "shell.execute_reply.started": "2023-06-09T02:11:40.531400Z"
164
+ }
165
+ },
166
+ "outputs": [
167
+ {
168
+ "name": "stderr",
169
+ "output_type": "stream",
170
+ "text": [
171
+ "/usr/local/lib/python3.10/dist-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.\n",
172
+ " warnings.warn(\n",
173
+ "/usr/local/lib/python3.10/dist-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=AlexNet_Weights.IMAGENET1K_V1`. You can also use `weights=AlexNet_Weights.DEFAULT` to get the most up-to-date weights.\n",
174
+ " warnings.warn(msg)\n",
175
+ "Downloading: \"https://download.pytorch.org/models/alexnet-owt-7be5be79.pth\" to /root/.cache/torch/hub/checkpoints/alexnet-owt-7be5be79.pth\n",
176
+ "100%|██████████| 233M/233M [00:06<00:00, 40.0MB/s] \n"
177
+ ]
178
+ }
179
+ ],
180
+ "source": [
181
+ "# 使用AlexNet模型\n",
182
+ "model = models.alexnet(pretrained=True).to(device).eval()"
183
+ ]
184
+ },
185
+ {
186
+ "cell_type": "code",
187
+ "execution_count": 43,
188
+ "metadata": {
189
+ "execution": {
190
+ "iopub.execute_input": "2023-06-09T02:12:39.020940Z",
191
+ "iopub.status.busy": "2023-06-09T02:12:39.020565Z",
192
+ "iopub.status.idle": "2023-06-09T02:12:39.029096Z",
193
+ "shell.execute_reply": "2023-06-09T02:12:39.025790Z",
194
+ "shell.execute_reply.started": "2023-06-09T02:12:39.020907Z"
195
+ }
196
+ },
197
+ "outputs": [],
198
+ "source": [
199
+ "#adam的最大迭代次数 论文中建议10000次 测试阶段1000也可以 1000次可以完成95%的优化工作\n",
200
+ "max_iterations=100 #1000\n",
201
+ "#adam学习速率 \n",
202
+ "learning_rate=0.01\n",
203
+ "#二分查找最大次数\n",
204
+ "binary_search_steps=2#10\n",
205
+ "#c的初始值\n",
206
+ "initial_const=1e2\n",
207
+ "confidence=initial_const\n",
208
+ "\n",
209
+ "#k值\n",
210
+ "k=40\n",
211
+ "\n",
212
+ "#像素值区间\n",
213
+ "boxmin = -3.0\n",
214
+ "boxmax = 3.0\n",
215
+ "\n",
216
+ "#类别数 pytorch的实现里面是1000\n",
217
+ "num_labels=1000"
218
+ ]
219
+ },
220
+ {
221
+ "cell_type": "code",
222
+ "execution_count": 44,
223
+ "metadata": {
224
+ "execution": {
225
+ "iopub.execute_input": "2023-06-09T02:14:18.682336Z",
226
+ "iopub.status.busy": "2023-06-09T02:14:18.681949Z",
227
+ "iopub.status.idle": "2023-06-09T02:14:18.692406Z",
228
+ "shell.execute_reply": "2023-06-09T02:14:18.691346Z",
229
+ "shell.execute_reply.started": "2023-06-09T02:14:18.682306Z"
230
+ }
231
+ },
232
+ "outputs": [],
233
+ "source": [
234
+ "#攻击目标标签 必须使用one hot编码\n",
235
+ "target_label=288\n",
236
+ "tlab=Variable(torch.from_numpy(np.eye(num_labels)[target_label]).to(device).float())"
237
+ ]
238
+ },
239
+ {
240
+ "cell_type": "code",
241
+ "execution_count": 45,
242
+ "metadata": {
243
+ "execution": {
244
+ "iopub.execute_input": "2023-06-09T02:15:33.227206Z",
245
+ "iopub.status.busy": "2023-06-09T02:15:33.226524Z",
246
+ "iopub.status.idle": "2023-06-09T02:15:33.236713Z",
247
+ "shell.execute_reply": "2023-06-09T02:15:33.235815Z",
248
+ "shell.execute_reply.started": "2023-06-09T02:15:33.227171Z"
249
+ }
250
+ },
251
+ "outputs": [
252
+ {
253
+ "data": {
254
+ "text/plain": [
255
+ "(1000,)"
256
+ ]
257
+ },
258
+ "execution_count": 45,
259
+ "metadata": {},
260
+ "output_type": "execute_result"
261
+ }
262
+ ],
263
+ "source": [
264
+ "# 下面是调试内容\n",
265
+ "np.eye(num_labels)[target_label].shape"
266
+ ]
267
+ },
268
+ {
269
+ "cell_type": "code",
270
+ "execution_count": 46,
271
+ "metadata": {
272
+ "execution": {
273
+ "iopub.execute_input": "2023-06-09T02:16:32.401599Z",
274
+ "iopub.status.busy": "2023-06-09T02:16:32.401249Z",
275
+ "iopub.status.idle": "2023-06-09T02:16:32.407861Z",
276
+ "shell.execute_reply": "2023-06-09T02:16:32.406807Z",
277
+ "shell.execute_reply.started": "2023-06-09T02:16:32.401569Z"
278
+ }
279
+ },
280
+ "outputs": [
281
+ {
282
+ "data": {
283
+ "text/plain": [
284
+ "torch.Size([1000])"
285
+ ]
286
+ },
287
+ "execution_count": 46,
288
+ "metadata": {},
289
+ "output_type": "execute_result"
290
+ }
291
+ ],
292
+ "source": [
293
+ "# print(tlab)\n",
294
+ "tlab.shape"
295
+ ]
296
+ },
297
+ {
298
+ "cell_type": "code",
299
+ "execution_count": 47,
300
+ "metadata": {
301
+ "execution": {
302
+ "iopub.execute_input": "2023-06-09T02:34:21.875455Z",
303
+ "iopub.status.busy": "2023-06-09T02:34:21.875101Z",
304
+ "iopub.status.idle": "2023-06-09T02:34:21.879945Z",
305
+ "shell.execute_reply": "2023-06-09T02:34:21.878969Z",
306
+ "shell.execute_reply.started": "2023-06-09T02:34:21.875428Z"
307
+ }
308
+ },
309
+ "outputs": [],
310
+ "source": [
311
+ "shape = [1,3,224,224]"
312
+ ]
313
+ },
314
+ {
315
+ "cell_type": "code",
316
+ "execution_count": 48,
317
+ "metadata": {
318
+ "execution": {
319
+ "iopub.execute_input": "2023-06-09T02:34:24.649587Z",
320
+ "iopub.status.busy": "2023-06-09T02:34:24.649220Z",
321
+ "iopub.status.idle": "2023-06-09T02:34:24.655711Z",
322
+ "shell.execute_reply": "2023-06-09T02:34:24.654656Z",
323
+ "shell.execute_reply.started": "2023-06-09T02:34:24.649557Z"
324
+ }
325
+ },
326
+ "outputs": [],
327
+ "source": [
328
+ "#c的初始化边界\n",
329
+ "lower_bound = 0\n",
330
+ "c=initial_const\n",
331
+ "upper_bound = 1e10\n",
332
+ "\n",
333
+ "# the best l2, score, and image attack\n",
334
+ "o_bestl2 = 1e10\n",
335
+ "o_bestscore = -1\n",
336
+ "o_bestattack = [np.zeros(shape)] # 初始化攻击样本"
337
+ ]
338
+ },
339
+ {
340
+ "cell_type": "code",
341
+ "execution_count": 49,
342
+ "metadata": {
343
+ "execution": {
344
+ "iopub.execute_input": "2023-06-09T02:48:29.739149Z",
345
+ "iopub.status.busy": "2023-06-09T02:48:29.738714Z",
346
+ "iopub.status.idle": "2023-06-09T02:50:05.900939Z",
347
+ "shell.execute_reply": "2023-06-09T02:50:05.898824Z",
348
+ "shell.execute_reply.started": "2023-06-09T02:48:29.739114Z"
349
+ }
350
+ },
351
+ "outputs": [
352
+ {
353
+ "name": "stdout",
354
+ "output_type": "stream",
355
+ "text": [
356
+ "o_bestl2=10000000000.0 confidence=100.0\n",
357
+ "iteration=10 loss=4043.884521484375 loss1=4004.571533203125 loss2=39.31290054321289\n",
358
+ "attack success l2=41.467403411865234 target_label=288\n",
359
+ "iteration=20 loss=3408.408935546875 loss1=3353.29931640625 loss2=55.10960006713867\n",
360
+ "iteration=30 loss=2528.68896484375 loss1=2462.251220703125 loss2=66.43777465820312\n",
361
+ "iteration=40 loss=1324.76171875 loss1=1245.8822021484375 loss2=78.87956237792969\n",
362
+ "iteration=50 loss=94.07406616210938 loss1=0.0 loss2=94.07406616210938\n",
363
+ "iteration=60 loss=105.19638061523438 loss1=0.0 loss2=105.19638061523438\n",
364
+ "iteration=70 loss=109.48017120361328 loss1=0.0 loss2=109.48017120361328\n",
365
+ "iteration=80 loss=110.49360656738281 loss1=0.0 loss2=110.49360656738281\n",
366
+ "iteration=90 loss=110.16913604736328 loss1=0.0 loss2=110.16913604736328\n",
367
+ "iteration=100 loss=109.30499267578125 loss1=0.0 loss2=109.30499267578125\n",
368
+ "\n",
369
+ "outer_step=0 confidence 100.0->50.0\n",
370
+ "o_bestl2=41.467403411865234 confidence=50.0\n",
371
+ "iteration=10 loss=2037.63134765625 loss1=1998.5057373046875 loss2=39.125579833984375\n",
372
+ "attack success l2=39.125579833984375 target_label=288\n",
373
+ "iteration=20 loss=1827.0526123046875 loss1=1773.560302734375 loss2=53.49225616455078\n",
374
+ "iteration=30 loss=1498.107421875 loss1=1435.7236328125 loss2=62.38383102416992\n",
375
+ "iteration=40 loss=1089.6231689453125 loss1=1017.6951293945312 loss2=71.92801666259766\n",
376
+ "iteration=50 loss=588.183837890625 loss1=503.7847595214844 loss2=84.39906311035156\n",
377
+ "iteration=60 loss=98.67858123779297 loss1=0.0 loss2=98.67858123779297\n",
378
+ "iteration=70 loss=108.53038024902344 loss1=0.0 loss2=108.53038024902344\n",
379
+ "iteration=80 loss=111.98412322998047 loss1=0.0 loss2=111.98412322998047\n",
380
+ "iteration=90 loss=112.11483764648438 loss1=0.0 loss2=112.11483764648438\n",
381
+ "iteration=100 loss=110.87601470947266 loss1=0.0 loss2=110.87601470947266\n",
382
+ "\n",
383
+ "outer_step=1 confidence 50.0->25.0\n"
384
+ ]
385
+ }
386
+ ],
387
+ "source": [
388
+ "# the resulting image, tanh'd to keep bounded from boxmin to boxmax\n",
389
+ "boxmul = (boxmax - boxmin) / 2.\n",
390
+ "boxplus = (boxmin + boxmax) / 2.\n",
391
+ "\n",
392
+ "for outer_step in range(binary_search_steps):\n",
393
+ " print(\"o_bestl2={} confidence={}\".format(o_bestl2,confidence) )\n",
394
+ " \n",
395
+ " #把原始图像转换成图像数据和扰动的形态\n",
396
+ " timg = Variable(torch.from_numpy(np.arctanh((img - boxplus) / boxmul * 0.999999)).to(device).float())\n",
397
+ " modifier=Variable(torch.zeros_like(timg).to(device).float())\n",
398
+ " \n",
399
+ " \n",
400
+ " #图像数据的扰动量梯度可以获取\n",
401
+ " modifier.requires_grad = True\n",
402
+ " \n",
403
+ "\n",
404
+ " #定义优化器 仅优化modifier\n",
405
+ " optimizer = torch.optim.Adam([modifier],lr=learning_rate)\n",
406
+ " \n",
407
+ " for iteration in range(1,max_iterations+1):\n",
408
+ " optimizer.zero_grad()\n",
409
+ " \n",
410
+ " #定义新输入\n",
411
+ " newimg = torch.tanh(modifier + timg) * boxmul + boxplus\n",
412
+ " \n",
413
+ " output=model(newimg)\n",
414
+ " \n",
415
+ " #定义cw中的损失函数\n",
416
+ " \n",
417
+ " #l2范数\n",
418
+ " #l2dist = tf.reduce_sum(tf.square(newimg-(tf.tanh(timg) * boxmul + boxplus)),[1,2,3])\n",
419
+ " #loss2 = tf.reduce_sum(l2dist)\n",
420
+ " loss2=torch.dist(newimg,(torch.tanh(timg) * boxmul + boxplus),p=2)\n",
421
+ " \n",
422
+ " \n",
423
+ " real=torch.max(output*tlab)\n",
424
+ " other=torch.max((1-tlab)*output) \n",
425
+ " loss1=other-real+k \n",
426
+ " loss1=torch.clamp(loss1,min=0)\n",
427
+ " \n",
428
+ " loss1=confidence*loss1\n",
429
+ " \n",
430
+ " loss=loss1+loss2\n",
431
+ " \n",
432
+ " \n",
433
+ " loss.backward(retain_graph=True)\n",
434
+ "\n",
435
+ " optimizer.step()\n",
436
+ " \n",
437
+ " l2=loss2\n",
438
+ " \n",
439
+ " sc=output.data.cpu().numpy()\n",
440
+ " \n",
441
+ " # print out the losses every 10%\n",
442
+ " if iteration%(max_iterations//10) == 0:\n",
443
+ " print(\"iteration={} loss={} loss1={} loss2={}\".format(iteration,loss,loss1,loss2))\n",
444
+ " \n",
445
+ " if (l2 < o_bestl2) and (np.argmax(sc) == target_label ):\n",
446
+ " print(\"attack success l2={} target_label={}\".format(l2,target_label))\n",
447
+ " o_bestl2 = l2\n",
448
+ " o_bestscore = np.argmax(sc)\n",
449
+ " o_bestattack = newimg.data.cpu().numpy()\n",
450
+ " \n",
451
+ " confidence_old=-1\n",
452
+ " # 二分查找 最佳C值\n",
453
+ " if (o_bestscore == target_label) and o_bestscore != -1:\n",
454
+ " #攻击成功 减小c\n",
455
+ " upper_bound = min(upper_bound,confidence)\n",
456
+ " if upper_bound < 1e9:\n",
457
+ " print()\n",
458
+ " confidence_old=confidence\n",
459
+ " confidence = (lower_bound + upper_bound)/2\n",
460
+ " else:\n",
461
+ " lower_bound = max(lower_bound,confidence)\n",
462
+ " confidence_old=confidence\n",
463
+ " if upper_bound < 1e9:\n",
464
+ " confidence = (lower_bound + upper_bound)/2\n",
465
+ " else:\n",
466
+ " confidence *= 10\n",
467
+ " \n",
468
+ " print(\"outer_step={} confidence {}->{}\".format(outer_step,confidence_old,confidence))"
469
+ ]
470
+ },
471
+ {
472
+ "cell_type": "code",
473
+ "execution_count": 50,
474
+ "metadata": {
475
+ "execution": {
476
+ "iopub.execute_input": "2023-06-09T02:56:04.716191Z",
477
+ "iopub.status.busy": "2023-06-09T02:56:04.715823Z",
478
+ "iopub.status.idle": "2023-06-09T02:56:04.722050Z",
479
+ "shell.execute_reply": "2023-06-09T02:56:04.721077Z",
480
+ "shell.execute_reply.started": "2023-06-09T02:56:04.716162Z"
481
+ }
482
+ },
483
+ "outputs": [
484
+ {
485
+ "name": "stdout",
486
+ "output_type": "stream",
487
+ "text": [
488
+ "(1, 3, 224, 224)\n",
489
+ "(1, 3, 224, 224)\n"
490
+ ]
491
+ }
492
+ ],
493
+ "source": [
494
+ "print(o_bestattack.shape)\n",
495
+ "print(img.shape)"
496
+ ]
497
+ },
498
+ {
499
+ "cell_type": "code",
500
+ "execution_count": 51,
501
+ "metadata": {
502
+ "execution": {
503
+ "iopub.execute_input": "2023-06-09T02:59:51.731662Z",
504
+ "iopub.status.busy": "2023-06-09T02:59:51.731230Z",
505
+ "iopub.status.idle": "2023-06-09T02:59:51.740758Z",
506
+ "shell.execute_reply": "2023-06-09T02:59:51.739602Z",
507
+ "shell.execute_reply.started": "2023-06-09T02:59:51.731632Z"
508
+ }
509
+ },
510
+ "outputs": [],
511
+ "source": [
512
+ "# 定义一个展示的函数\n",
513
+ "def show_images_diff(original_img,original_label,adversarial_img,adversarial_label):\n",
514
+ " plt.figure()\n",
515
+ " \n",
516
+ " plt.subplot(131)\n",
517
+ " plt.title('Original')\n",
518
+ " plt.imshow(original_img)\n",
519
+ " plt.axis('off')\n",
520
+ "\n",
521
+ " plt.subplot(132)\n",
522
+ " plt.title('Adversarial')\n",
523
+ " plt.imshow(adversarial_img)\n",
524
+ " plt.axis('off')\n",
525
+ "\n",
526
+ " plt.subplot(133)\n",
527
+ " plt.title('Adversarial-Original')\n",
528
+ " difference = adversarial_img - original_img\n",
529
+ " \n",
530
+ " l0=np.where(difference!=0)[0].shape[0]\n",
531
+ " l2=np.linalg.norm(difference)\n",
532
+ " #print(difference)\n",
533
+ " print(\"l0={} l2={}\".format(l0,l2))\n",
534
+ " \n",
535
+ " #(-1,1) -> (0,1)\n",
536
+ " difference=difference / abs(difference).max()/2.0+0.5\n",
537
+ " \n",
538
+ " plt.imshow(difference,cmap=plt.cm.gray)\n",
539
+ " plt.axis('off')\n",
540
+ " plt.tight_layout()\n",
541
+ " plt.show()"
542
+ ]
543
+ },
544
+ {
545
+ "cell_type": "code",
546
+ "execution_count": 56,
547
+ "metadata": {
548
+ "execution": {
549
+ "iopub.execute_input": "2023-06-09T03:05:08.845633Z",
550
+ "iopub.status.busy": "2023-06-09T03:05:08.845272Z",
551
+ "iopub.status.idle": "2023-06-09T03:05:08.851100Z",
552
+ "shell.execute_reply": "2023-06-09T03:05:08.850161Z",
553
+ "shell.execute_reply.started": "2023-06-09T03:05:08.845605Z"
554
+ }
555
+ },
556
+ "outputs": [
557
+ {
558
+ "name": "stdout",
559
+ "output_type": "stream",
560
+ "text": [
561
+ "(3, 224, 224)\n"
562
+ ]
563
+ }
564
+ ],
565
+ "source": [
566
+ "adv=o_bestattack[0]\n",
567
+ "print(adv.shape)"
568
+ ]
569
+ },
570
+ {
571
+ "cell_type": "code",
572
+ "execution_count": null,
573
+ "metadata": {
574
+ "execution": {
575
+ "iopub.execute_input": "2023-06-09T03:05:26.083340Z",
576
+ "iopub.status.busy": "2023-06-09T03:05:26.082604Z",
577
+ "iopub.status.idle": "2023-06-09T03:05:26.089038Z",
578
+ "shell.execute_reply": "2023-06-09T03:05:26.087921Z",
579
+ "shell.execute_reply.started": "2023-06-09T03:05:26.083304Z"
580
+ }
581
+ },
582
+ "outputs": [],
583
+ "source": [
584
+ "adv = adv.transpose(1, 2, 0)\n",
585
+ "print(adv.shape)"
586
+ ]
587
+ },
588
+ {
589
+ "cell_type": "code",
590
+ "execution_count": null,
591
+ "metadata": {
592
+ "execution": {
593
+ "iopub.execute_input": "2023-06-09T03:07:20.373635Z",
594
+ "iopub.status.busy": "2023-06-09T03:07:20.373225Z",
595
+ "iopub.status.idle": "2023-06-09T03:07:20.791256Z",
596
+ "shell.execute_reply": "2023-06-09T03:07:20.790373Z",
597
+ "shell.execute_reply.started": "2023-06-09T03:07:20.373602Z"
598
+ }
599
+ },
600
+ "outputs": [],
601
+ "source": [
602
+ "adv = (adv * std) + mean\n",
603
+ "adv = adv * 255.0 # 恢复到255的格式\n",
604
+ "adv = np.clip(adv, 0, 255).astype(np.uint8)\n",
605
+ "\n",
606
+ "show_images_diff(orig,0,adv,0)"
607
+ ]
608
+ },
609
+ {
610
+ "cell_type": "code",
611
+ "execution_count": 57,
612
+ "metadata": {
613
+ "execution": {
614
+ "iopub.execute_input": "2023-06-09T03:05:11.739431Z",
615
+ "iopub.status.busy": "2023-06-09T03:05:11.739062Z",
616
+ "iopub.status.idle": "2023-06-09T03:05:13.225249Z",
617
+ "shell.execute_reply": "2023-06-09T03:05:13.223625Z",
618
+ "shell.execute_reply.started": "2023-06-09T03:05:11.739403Z"
619
+ }
620
+ },
621
+ "outputs": [
622
+ {
623
+ "ename": "TypeError",
624
+ "evalue": "Invalid shape (3, 224, 224) for image data",
625
+ "output_type": "error",
626
+ "traceback": [
627
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
628
+ "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
629
+ "\u001b[0;32m<ipython-input-57-5bc605183c9d>\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimshow\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0madv\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
630
+ "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/matplotlib/pyplot.py\u001b[0m in \u001b[0;36mimshow\u001b[0;34m(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, interpolation_stage, filternorm, filterrad, resample, url, data, **kwargs)\u001b[0m\n\u001b[1;32m 2693\u001b[0m \u001b[0minterpolation_stage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilternorm\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilterrad\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m4.0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2694\u001b[0m resample=None, url=None, data=None, **kwargs):\n\u001b[0;32m-> 2695\u001b[0;31m __ret = gca().imshow(\n\u001b[0m\u001b[1;32m 2696\u001b[0m \u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcmap\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcmap\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnorm\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mnorm\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maspect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0maspect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2697\u001b[0m \u001b[0minterpolation\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0minterpolation\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0malpha\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0malpha\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvmin\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mvmin\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
631
+ "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/matplotlib/__init__.py\u001b[0m in \u001b[0;36minner\u001b[0;34m(ax, data, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1440\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0minner\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0max\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1441\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdata\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1442\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0max\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mmap\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msanitize_sequence\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1443\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1444\u001b[0m \u001b[0mbound\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnew_sig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbind\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0max\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
632
+ "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/matplotlib/axes/_axes.py\u001b[0m in \u001b[0;36mimshow\u001b[0;34m(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, interpolation_stage, filternorm, filterrad, resample, url, **kwargs)\u001b[0m\n\u001b[1;32m 5663\u001b[0m **kwargs)\n\u001b[1;32m 5664\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 5665\u001b[0;31m \u001b[0mim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_data\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5666\u001b[0m \u001b[0mim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_alpha\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0malpha\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5667\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mim\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_clip_path\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
633
+ "\u001b[0;32m/usr/local/lib/python3.10/dist-packages/matplotlib/image.py\u001b[0m in \u001b[0;36mset_data\u001b[0;34m(self, A)\u001b[0m\n\u001b[1;32m 708\u001b[0m if not (self._A.ndim == 2\n\u001b[1;32m 709\u001b[0m or self._A.ndim == 3 and self._A.shape[-1] in [3, 4]):\n\u001b[0;32m--> 710\u001b[0;31m raise TypeError(\"Invalid shape {} for image data\"\n\u001b[0m\u001b[1;32m 711\u001b[0m .format(self._A.shape))\n\u001b[1;32m 712\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
634
+ "\u001b[0;31mTypeError\u001b[0m: Invalid shape (3, 224, 224) for image data"
635
+ ]
636
+ },
637
+ {
638
+ "data": {
639
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbAAAAGiCAYAAACGUJO6AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAbB0lEQVR4nO3df0zd1f3H8RfQcqmx0DrGhbKrrHX+tqWCZVgb53IniQbXPxaZNYURf0xlRnuz2WJbUKulq7Yjs2hj1ekfOqpGjbEEp0xiVJZGWhKdbU2lFWa8tyWu3I4qtNzz/WPfXocFywf50bc8H8nnD84+537OPWH36b2995LgnHMCAMCYxIleAAAAI0HAAAAmETAAgEkEDABgEgEDAJhEwAAAJhEwAIBJBAwAYBIBAwCYRMAAACZ5Dtjbb7+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S9TV1aXLL79czjkdO3ZMt956q+65557xWLIZQz2GR6NRffnll5o2bdqwbmfCn4FhfKxbt0719fV6+eWXlZKSMtHLOSUcPnxYS5cu1ZYtW5Senj7RyzmlxWIxZWRk6PHHH1deXp5KSkq0cuXKIf+q+mTV3NystWvX6tFHH9WOHTv00ksvadu2bVqzZs1EL+17acKfgfEnWoZnJPt03MMPP6x169bpzTff1Ny5c8dymRPK6x598skn2r9/v4qLi+NjsVhMkjRlyhTt2bNHc+bMGdtFT4CR/C5lZWVp6tSpSkpKio+df/75CofD6uvrU3Jy8piueSKMZJ9Wr16tpUuX6qabbpIkXXzxxerp6dEtt9yilStXjvrfw7JqqMfw1NTUYT/7kk6BZ2D8iZbhGck+SdL69eu1Zs0aNTY2Kj8/fzyWOmG87tF5552nDz74QG1tbfHj2muv1ZVXXqm2tjYFAoHxXP64Gcnv0sKFC7V379544CXp448/VlZW1vcyXtLI9unIkSMnROp49B1fOxs3ao/h3t5fMjbq6+udz+dzTz/9tPvoo4/cLbfc4mbMmOHC4bBzzrmlS5e6FStWxM9/99133ZQpU9zDDz/sdu3a5aqrqyfN2+i97NO6detccnKye/HFF93nn38ePw4fPjxRd2HMed2jb5os70L0uk8dHR1u+vTp7ne/+53bs2ePe+2111xGRoZ74IEHJuoujAuv+1RdXe2mT5/u/vrXv7r29nb3t7/9zc2ZM8ddd911E3UXxsXhw4fdzp073c6dO50kt3HjRrdz50736aefOuecW7FihVu6dGn8/ONvo//DH/7gdu3a5erq6uy+jd455x555BF35plnuuTkZLdgwQL3j3/8I/6/XXHFFa6srGzA+c8//7w755xzXHJysrvwwgvdtm3bxnnFE8PLPp111llO0glHdXX1+C98HHn9XfpfkyVgznnfp/fee88VFBQ4n8/nZs+e7R588EF37NixcV71+POyT0ePHnX33nuvmzNnjktJSXGBQMDdfvvt7t///vf4L3wcvfXWW4M+1hzfm7KyMnfFFVecMCc3N9clJye72bNnu7/85S+er8ufUwEAmDTh/wYGAMBIEDAAgEkEDABgEgEDAJhEwAAAJhEwAIBJBAwAYBIBAwCYRMAAACYRMACASQQMAGDS/wFzTP77mPX4nAAAAABJRU5ErkJggg==\n",
640
+ "text/plain": [
641
+ "<Figure size 640x480 with 1 Axes>"
642
+ ]
643
+ },
644
+ "metadata": {},
645
+ "output_type": "display_data"
646
+ }
647
+ ],
648
+ "source": [
649
+ "plt.imshow(adv)"
650
+ ]
651
+ },
652
+ {
653
+ "cell_type": "code",
654
+ "execution_count": null,
655
+ "metadata": {
656
+ "execution": {
657
+ "iopub.execute_input": "2023-06-09T03:15:08.027115Z",
658
+ "iopub.status.busy": "2023-06-09T03:15:08.026307Z",
659
+ "iopub.status.idle": "2023-06-09T03:15:08.066251Z",
660
+ "shell.execute_reply": "2023-06-09T03:15:08.064903Z",
661
+ "shell.execute_reply.started": "2023-06-09T03:15:08.027079Z"
662
+ }
663
+ },
664
+ "outputs": [],
665
+ "source": [
666
+ "import advbox"
667
+ ]
668
+ },
669
+ {
670
+ "cell_type": "code",
671
+ "execution_count": null,
672
+ "metadata": {},
673
+ "outputs": [],
674
+ "source": []
675
+ }
676
+ ],
677
+ "metadata": {
678
+ "kernelspec": {
679
+ "display_name": "Python 3",
680
+ "language": "python",
681
+ "name": "python3"
682
+ },
683
+ "language_info": {
684
+ "codemirror_mode": {
685
+ "name": "ipython",
686
+ "version": 3
687
+ },
688
+ "file_extension": ".py",
689
+ "mimetype": "text/x-python",
690
+ "name": "python",
691
+ "nbconvert_exporter": "python",
692
+ "pygments_lexer": "ipython3",
693
+ "version": "3.10.12"
694
+ }
695
+ },
696
+ "nbformat": 4,
697
+ "nbformat_minor": 4
698
+ }
benchmark/NBspecific_11/README.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset Information
2
+
3
+
4
+
5
+ ## Dataset: cow-attack
6
+
7
+ **Source:**
8
+ - **Title:** cow-attack
9
+ - **URL:** [https://www.kaggle.com/datasets/zhengcoming/cow-attack](https://www.kaggle.com/datasets/zhengcoming/cow-attack)
10
+ - **Attribution:** Shared on Kaggle or other platform.
11
+
12
+ **License:**
13
+ - **License Type:** Unknown
14
+ - **Summary:** Attribution and usage rules as specified by the dataset's license.
15
+
16
+
17
+
{data → benchmark}/NBspecific_11/data/cow.jpeg RENAMED
File without changes
benchmark/NBspecific_12/NBspecific_12.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport seaborn as sns\n%matplotlib inline\n","metadata":{"execution":{"iopub.status.busy":"2023-10-24T05:47:12.666295Z","iopub.execute_input":"2023-10-24T05:47:12.666676Z","iopub.status.idle":"2023-10-24T05:47:13.333365Z","shell.execute_reply.started":"2023-10-24T05:47:12.666644Z","shell.execute_reply":"2023-10-24T05:47:13.332563Z"},"trusted":true},"execution_count":46,"outputs":[]},{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n for filename in filenames:\n print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current sessionC:\\Users\\manak\\MANAK\\TF-Certification\\Kaggle\\S3 E24 Smoker Status\\EDA-and-Baseline.ipynb","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-10-24T05:32:58.819164Z","iopub.execute_input":"2023-10-24T05:32:58.819666Z","iopub.status.idle":"2023-10-24T05:32:58.832197Z","shell.execute_reply.started":"2023-10-24T05:32:58.819634Z","shell.execute_reply":"2023-10-24T05:32:58.831377Z"},"trusted":true},"execution_count":2,"outputs":[{"name":"stdout","text":"/kaggle/input/smoker-status-prediction-using-biosignals/train_dataset.csv\n/kaggle/input/smoker-status-prediction-using-biosignals/test_dataset.csv\n/kaggle/input/playground-series-s3e24/sample_submission.csv\n/kaggle/input/playground-series-s3e24/train.csv\n/kaggle/input/playground-series-s3e24/test.csv\n","output_type":"stream"}]},{"cell_type":"code","source":"class DataLoader:\n # 1. Get the competition data and original data\n # 2. Create a summary of the data\n # 3. Divide cols into numerical and categorical\n # 4. Create final training data set\n \n def __init__(self):\n self.train = pd.read_csv(\"/kaggle/input/playground-series-s3e24/train.csv\",index_col = 'id')\n self.test = pd.read_csv( \"/kaggle/input/playground-series-s3e24/test.csv\",index_col = 'id')\n self.original = pd.read_csv(\"/kaggle/input/smoker-status-prediction-using-biosignals/train_dataset.csv\")\n \n def _classifydataset(self)->None:\n self.train[\"Source\"] = 1\n self.test[\"Source\"] = 1\n self.original[\"Source\"] = 0\n \"\"\"\n As we can see from the description all \n values should be numeric in nature but cols\n 'uniq_Op','uniq_Opnd','total_Op','total_Opnd','branchCount' are object type\n we will replace all non numeric values with np.nan \n \"\"\"\n\n # def _missingvalue(self):\n # cols = ['uniq_Op','uniq_Opnd','total_Op','total_Opnd','branchCount']\n # def Numeric(x):\n # if x.isnumeric() or re.match(r\"\\d+\\.\\d+\",x):\n # return x\n # else:\n # return np.nan\n # for col in cols:\n # self.original[col] = (self.original[col].apply(Numeric))\n \n \n def join(self)-> pd.DataFrame:\n self.df = pd.concat([self.train,self.original],axis = 0,ignore_index = True)\n self.df = self.df.drop_duplicates()\n self.df.index = np.arange(len(self.df))\n self.df.index.name = 'id'\n return self.df \n \n def variables(self):\n self.numvars = [i for i in pp.train.columns if pp.train[i].nunique() > 10]\n self.catvars = list(set(self.train.columns) - set(self.numvars))\n return (self.numvars, self.catvars)\n \n def execute(self):\n self. _classifydataset()\n # self._missingvalue()\n self.join()\n return self\n \n def information(self,type):\n if type == 'train':\n return summary(self.train)\n elif type == 'test':\n return summary(self.test)\n elif type == 'original':\n return summary(self.df)\n else:\n return -1\n \n\ndef summary(df: pd.DataFrame)-> pd.DataFrame:\n summary = pd.DataFrame(df.dtypes,columns=['dtype'])\n summary[\"#Missing\"] = df.isna().sum().values\n summary[\"%Missing\"] = summary[\"#Missing\"]/len(df) * 100\n summary[\"nuniques\"] = df.nunique().values\n summary[\"type\"] = df.dtypes\n return summary","metadata":{"execution":{"iopub.status.busy":"2023-10-24T05:45:44.799871Z","iopub.execute_input":"2023-10-24T05:45:44.800959Z","iopub.status.idle":"2023-10-24T05:45:44.814985Z","shell.execute_reply.started":"2023-10-24T05:45:44.800922Z","shell.execute_reply":"2023-10-24T05:45:44.814036Z"},"trusted":true},"execution_count":41,"outputs":[]},{"cell_type":"code","source":"pp = DataLoader()\npp.execute()\npp.train.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-24T05:45:45.202944Z","iopub.execute_input":"2023-10-24T05:45:45.203530Z","iopub.status.idle":"2023-10-24T05:45:45.985650Z","shell.execute_reply.started":"2023-10-24T05:45:45.203484Z","shell.execute_reply":"2023-10-24T05:45:45.984605Z"},"trusted":true},"execution_count":42,"outputs":[{"execution_count":42,"output_type":"execute_result","data":{"text/plain":" age height(cm) weight(kg) waist(cm) eyesight(left) eyesight(right) \\\nid \n0 55 165 60 81.0 0.5 0.6 \n1 70 165 65 89.0 0.6 0.7 \n2 20 170 75 81.0 0.4 0.5 \n3 35 180 95 105.0 1.5 1.2 \n4 30 165 60 80.5 1.5 1.0 \n\n hearing(left) hearing(right) systolic relaxation ... LDL hemoglobin \\\nid ... \n0 1 1 135 87 ... 75 16.5 \n1 2 2 146 83 ... 126 16.2 \n2 1 1 118 75 ... 93 17.4 \n3 1 1 131 88 ... 102 15.9 \n4 1 1 121 76 ... 93 15.4 \n\n Urine protein serum creatinine AST ALT Gtp dental caries smoking \\\nid \n0 1 1.0 22 25 27 0 1 \n1 1 1.1 27 23 37 1 0 \n2 1 0.8 27 31 53 0 1 \n3 1 1.0 20 27 30 1 0 \n4 1 0.8 19 13 17 0 1 \n\n Source \nid \n0 1 \n1 1 \n2 1 \n3 1 \n4 1 \n\n[5 rows x 24 columns]","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>age</th>\n <th>height(cm)</th>\n <th>weight(kg)</th>\n <th>waist(cm)</th>\n <th>eyesight(left)</th>\n <th>eyesight(right)</th>\n <th>hearing(left)</th>\n <th>hearing(right)</th>\n <th>systolic</th>\n <th>relaxation</th>\n <th>...</th>\n <th>LDL</th>\n <th>hemoglobin</th>\n <th>Urine protein</th>\n <th>serum creatinine</th>\n <th>AST</th>\n <th>ALT</th>\n <th>Gtp</th>\n <th>dental caries</th>\n <th>smoking</th>\n <th>Source</th>\n </tr>\n <tr>\n <th>id</th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>55</td>\n <td>165</td>\n <td>60</td>\n <td>81.0</td>\n <td>0.5</td>\n <td>0.6</td>\n <td>1</td>\n <td>1</td>\n <td>135</td>\n <td>87</td>\n <td>...</td>\n <td>75</td>\n <td>16.5</td>\n <td>1</td>\n <td>1.0</td>\n <td>22</td>\n <td>25</td>\n <td>27</td>\n <td>0</td>\n <td>1</td>\n <td>1</td>\n </tr>\n <tr>\n <th>1</th>\n <td>70</td>\n <td>165</td>\n <td>65</td>\n <td>89.0</td>\n <td>0.6</td>\n <td>0.7</td>\n <td>2</td>\n <td>2</td>\n <td>146</td>\n <td>83</td>\n <td>...</td>\n <td>126</td>\n <td>16.2</td>\n <td>1</td>\n <td>1.1</td>\n <td>27</td>\n <td>23</td>\n <td>37</td>\n <td>1</td>\n <td>0</td>\n <td>1</td>\n </tr>\n <tr>\n <th>2</th>\n <td>20</td>\n <td>170</td>\n <td>75</td>\n <td>81.0</td>\n <td>0.4</td>\n <td>0.5</td>\n <td>1</td>\n <td>1</td>\n <td>118</td>\n <td>75</td>\n <td>...</td>\n <td>93</td>\n <td>17.4</td>\n <td>1</td>\n <td>0.8</td>\n <td>27</td>\n <td>31</td>\n <td>53</td>\n <td>0</td>\n <td>1</td>\n <td>1</td>\n </tr>\n <tr>\n <th>3</th>\n <td>35</td>\n <td>180</td>\n <td>95</td>\n <td>105.0</td>\n <td>1.5</td>\n <td>1.2</td>\n <td>1</td>\n <td>1</td>\n <td>131</td>\n <td>88</td>\n <td>...</td>\n <td>102</td>\n <td>15.9</td>\n <td>1</td>\n <td>1.0</td>\n <td>20</td>\n <td>27</td>\n <td>30</td>\n <td>1</td>\n <td>0</td>\n <td>1</td>\n </tr>\n <tr>\n <th>4</th>\n <td>30</td>\n <td>165</td>\n <td>60</td>\n <td>80.5</td>\n <td>1.5</td>\n <td>1.0</td>\n <td>1</td>\n <td>1</td>\n <td>121</td>\n <td>76</td>\n <td>...</td>\n <td>93</td>\n <td>15.4</td>\n <td>1</td>\n <td>0.8</td>\n <td>19</td>\n <td>13</td>\n <td>17</td>\n <td>0</td>\n <td>1</td>\n <td>1</td>\n </tr>\n </tbody>\n</table>\n<p>5 rows × 24 columns</p>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"num,cat = pp.variables()","metadata":{"execution":{"iopub.status.busy":"2023-10-24T05:45:47.423944Z","iopub.execute_input":"2023-10-24T05:45:47.424378Z","iopub.status.idle":"2023-10-24T05:45:47.456140Z","shell.execute_reply.started":"2023-10-24T05:45:47.424342Z","shell.execute_reply":"2023-10-24T05:45:47.455321Z"},"trusted":true},"execution_count":43,"outputs":[]},{"cell_type":"code","source":"cat.remove('Source')\ncat.remove('smoking')","metadata":{"execution":{"iopub.status.busy":"2023-10-24T05:45:55.533261Z","iopub.execute_input":"2023-10-24T05:45:55.533625Z","iopub.status.idle":"2023-10-24T05:45:55.538246Z","shell.execute_reply.started":"2023-10-24T05:45:55.533593Z","shell.execute_reply":"2023-10-24T05:45:55.537161Z"},"trusted":true},"execution_count":44,"outputs":[]},{"cell_type":"markdown","source":"## EDA and Graphs","metadata":{"execution":{"iopub.status.busy":"2023-10-24T05:45:22.405192Z","iopub.execute_input":"2023-10-24T05:45:22.405556Z","iopub.status.idle":"2023-10-24T05:45:22.412023Z","shell.execute_reply.started":"2023-10-24T05:45:22.405525Z","shell.execute_reply":"2023-10-24T05:45:22.410985Z"}}},{"cell_type":"code","source":"fig, axs = plt.subplots(6, 3, figsize=(7, 17))\nfor col,ax in zip(numvars,axs.ravel()):\n if pp.train[col].dtype == float or pp.train[col].dtype == int:\n sns.histplot(ax = ax, data = pp.train[col],bins=100)\n plt.xlabel(col)\n ax.set_xticklabels(ax.get_xticklabels(),fontsize=0.1)\n ax.set(xlim = (0,None),ylim = (0,None))\n else:\n vc = pp.train[col].value_counts()\n ax.bar(vc.index,vc.values)\n plt.xlabel(col)\nfig.suptitle('Feature distributions', y=1.02, fontsize=20)\nplt.tight_layout()","metadata":{"execution":{"iopub.status.busy":"2023-10-24T05:46:36.494364Z","iopub.execute_input":"2023-10-24T05:46:36.494735Z","iopub.status.idle":"2023-10-24T05:46:36.529709Z","shell.execute_reply.started":"2023-10-24T05:46:36.494705Z","shell.execute_reply":"2023-10-24T05:46:36.528579Z"},"trusted":true},"execution_count":45,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)","Cell \u001b[0;32mIn[45], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m fig, axs \u001b[38;5;241m=\u001b[39m \u001b[43mplt\u001b[49m\u001b[38;5;241m.\u001b[39msubplots(\u001b[38;5;241m6\u001b[39m, \u001b[38;5;241m3\u001b[39m, figsize\u001b[38;5;241m=\u001b[39m(\u001b[38;5;241m7\u001b[39m, \u001b[38;5;241m17\u001b[39m))\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m col,ax \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mzip\u001b[39m(numvars,axs\u001b[38;5;241m.\u001b[39mravel()):\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m pp\u001b[38;5;241m.\u001b[39mtrain[col]\u001b[38;5;241m.\u001b[39mdtype \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mfloat\u001b[39m \u001b[38;5;129;01mor\u001b[39;00m pp\u001b[38;5;241m.\u001b[39mtrain[col]\u001b[38;5;241m.\u001b[39mdtype \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mint\u001b[39m:\n","\u001b[0;31mNameError\u001b[0m: name 'plt' is not defined"],"ename":"NameError","evalue":"name 'plt' is not defined","output_type":"error"}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}
benchmark/NBspecific_12/NBspecific_12_fixed.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
benchmark/NBspecific_12/NBspecific_12_reproduced.ipynb ADDED
@@ -0,0 +1,539 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": []
9
+ },
10
+ {
11
+ "cell_type": "markdown",
12
+ "metadata": {},
13
+ "source": []
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "metadata": {
19
+ "execution": {
20
+ "iopub.execute_input": "2023-10-24T05:47:12.666676Z",
21
+ "iopub.status.busy": "2023-10-24T05:47:12.666295Z",
22
+ "iopub.status.idle": "2023-10-24T05:47:13.333365Z",
23
+ "shell.execute_reply": "2023-10-24T05:47:13.332563Z",
24
+ "shell.execute_reply.started": "2023-10-24T05:47:12.666644Z"
25
+ }
26
+ },
27
+ "outputs": [],
28
+ "source": [
29
+ "import matplotlib.pyplot as plt\n",
30
+ "import seaborn as sns\n",
31
+ "%matplotlib inline\n"
32
+ ]
33
+ },
34
+ {
35
+ "cell_type": "code",
36
+ "execution_count": 3,
37
+ "metadata": {
38
+ "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
39
+ "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
40
+ "execution": {
41
+ "iopub.execute_input": "2023-10-24T05:32:58.819666Z",
42
+ "iopub.status.busy": "2023-10-24T05:32:58.819164Z",
43
+ "iopub.status.idle": "2023-10-24T05:32:58.832197Z",
44
+ "shell.execute_reply": "2023-10-24T05:32:58.831377Z",
45
+ "shell.execute_reply.started": "2023-10-24T05:32:58.819634Z"
46
+ }
47
+ },
48
+ "outputs": [
49
+ {
50
+ "name": "stdout",
51
+ "output_type": "stream",
52
+ "text": [
53
+ "data/playground-series-s3e24/test.csv.zip\n",
54
+ "data/playground-series-s3e24/train.csv.zip\n",
55
+ "data/smoker-status-prediction-using-biosignals/test_dataset.csv.zip\n",
56
+ "data/smoker-status-prediction-using-biosignals/train_dataset.csv.zip\n"
57
+ ]
58
+ }
59
+ ],
60
+ "source": [
61
+ "# This Python 3 environment comes with many helpful analytics libraries installed\n",
62
+ "# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n",
63
+ "# For example, here's several helpful packages to load\n",
64
+ "\n",
65
+ "import numpy as np # linear algebra\n",
66
+ "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
67
+ "\n",
68
+ "# Input data files are available in the read-only \"../input/\" directory\n",
69
+ "# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n",
70
+ "\n",
71
+ "import os\n",
72
+ "for dirname, _, filenames in os.walk('data'):\n",
73
+ " for filename in filenames:\n",
74
+ " print(os.path.join(dirname, filename))\n",
75
+ "\n",
76
+ "# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n",
77
+ "# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current sessionC:\\Users\\manak\\MANAK\\TF-Certification\\Kaggle\\S3 E24 Smoker Status\\EDA-and-Baseline.ipynb"
78
+ ]
79
+ },
80
+ {
81
+ "cell_type": "code",
82
+ "execution_count": 4,
83
+ "metadata": {
84
+ "execution": {
85
+ "iopub.execute_input": "2023-10-24T05:45:44.800959Z",
86
+ "iopub.status.busy": "2023-10-24T05:45:44.799871Z",
87
+ "iopub.status.idle": "2023-10-24T05:45:44.814985Z",
88
+ "shell.execute_reply": "2023-10-24T05:45:44.814036Z",
89
+ "shell.execute_reply.started": "2023-10-24T05:45:44.800922Z"
90
+ }
91
+ },
92
+ "outputs": [],
93
+ "source": [
94
+ "class DataLoader:\n",
95
+ " # 1. Get the competition data and original data\n",
96
+ " # 2. Create a summary of the data\n",
97
+ " # 3. Divide cols into numerical and categorical\n",
98
+ " # 4. Create final training data set\n",
99
+ " \n",
100
+ " def __init__(self):\n",
101
+ " self.train = pd.read_csv(\"data/playground-series-s3e24/train.csv.zip\",index_col = 'id')\n",
102
+ " self.test = pd.read_csv( \"data/playground-series-s3e24/test.csv.zip\",index_col = 'id')\n",
103
+ " self.original = pd.read_csv(\"data/smoker-status-prediction-using-biosignals/train_dataset.csv.zip\")\n",
104
+ " \n",
105
+ " def _classifydataset(self)->None:\n",
106
+ " self.train[\"Source\"] = 1\n",
107
+ " self.test[\"Source\"] = 1\n",
108
+ " self.original[\"Source\"] = 0\n",
109
+ " \"\"\"\n",
110
+ " As we can see from the description all \n",
111
+ " values should be numeric in nature but cols\n",
112
+ " 'uniq_Op','uniq_Opnd','total_Op','total_Opnd','branchCount' are object type\n",
113
+ " we will replace all non numeric values with np.nan \n",
114
+ " \"\"\"\n",
115
+ "\n",
116
+ " # def _missingvalue(self):\n",
117
+ " # cols = ['uniq_Op','uniq_Opnd','total_Op','total_Opnd','branchCount']\n",
118
+ " # def Numeric(x):\n",
119
+ " # if x.isnumeric() or re.match(r\"\\d+\\.\\d+\",x):\n",
120
+ " # return x\n",
121
+ " # else:\n",
122
+ " # return np.nan\n",
123
+ " # for col in cols:\n",
124
+ " # self.original[col] = (self.original[col].apply(Numeric))\n",
125
+ " \n",
126
+ " \n",
127
+ " def join(self)-> pd.DataFrame:\n",
128
+ " self.df = pd.concat([self.train,self.original],axis = 0,ignore_index = True)\n",
129
+ " self.df = self.df.drop_duplicates()\n",
130
+ " self.df.index = np.arange(len(self.df))\n",
131
+ " self.df.index.name = 'id'\n",
132
+ " return self.df \n",
133
+ " \n",
134
+ " def variables(self):\n",
135
+ " self.numvars = [i for i in pp.train.columns if pp.train[i].nunique() > 10]\n",
136
+ " self.catvars = list(set(self.train.columns) - set(self.numvars))\n",
137
+ " return (self.numvars, self.catvars)\n",
138
+ " \n",
139
+ " def execute(self):\n",
140
+ " self. _classifydataset()\n",
141
+ " # self._missingvalue()\n",
142
+ " self.join()\n",
143
+ " return self\n",
144
+ " \n",
145
+ " def information(self,type):\n",
146
+ " if type == 'train':\n",
147
+ " return summary(self.train)\n",
148
+ " elif type == 'test':\n",
149
+ " return summary(self.test)\n",
150
+ " elif type == 'original':\n",
151
+ " return summary(self.df)\n",
152
+ " else:\n",
153
+ " return -1\n",
154
+ " \n",
155
+ "\n",
156
+ "def summary(df: pd.DataFrame)-> pd.DataFrame:\n",
157
+ " summary = pd.DataFrame(df.dtypes,columns=['dtype'])\n",
158
+ " summary[\"#Missing\"] = df.isna().sum().values\n",
159
+ " summary[\"%Missing\"] = summary[\"#Missing\"]/len(df) * 100\n",
160
+ " summary[\"nuniques\"] = df.nunique().values\n",
161
+ " summary[\"type\"] = df.dtypes\n",
162
+ " return summary"
163
+ ]
164
+ },
165
+ {
166
+ "cell_type": "code",
167
+ "execution_count": 5,
168
+ "metadata": {
169
+ "execution": {
170
+ "iopub.execute_input": "2023-10-24T05:45:45.203530Z",
171
+ "iopub.status.busy": "2023-10-24T05:45:45.202944Z",
172
+ "iopub.status.idle": "2023-10-24T05:45:45.985650Z",
173
+ "shell.execute_reply": "2023-10-24T05:45:45.984605Z",
174
+ "shell.execute_reply.started": "2023-10-24T05:45:45.203484Z"
175
+ }
176
+ },
177
+ "outputs": [
178
+ {
179
+ "data": {
180
+ "text/html": [
181
+ "<div>\n",
182
+ "<style scoped>\n",
183
+ " .dataframe tbody tr th:only-of-type {\n",
184
+ " vertical-align: middle;\n",
185
+ " }\n",
186
+ "\n",
187
+ " .dataframe tbody tr th {\n",
188
+ " vertical-align: top;\n",
189
+ " }\n",
190
+ "\n",
191
+ " .dataframe thead th {\n",
192
+ " text-align: right;\n",
193
+ " }\n",
194
+ "</style>\n",
195
+ "<table border=\"1\" class=\"dataframe\">\n",
196
+ " <thead>\n",
197
+ " <tr style=\"text-align: right;\">\n",
198
+ " <th></th>\n",
199
+ " <th>age</th>\n",
200
+ " <th>height(cm)</th>\n",
201
+ " <th>weight(kg)</th>\n",
202
+ " <th>waist(cm)</th>\n",
203
+ " <th>eyesight(left)</th>\n",
204
+ " <th>eyesight(right)</th>\n",
205
+ " <th>hearing(left)</th>\n",
206
+ " <th>hearing(right)</th>\n",
207
+ " <th>systolic</th>\n",
208
+ " <th>relaxation</th>\n",
209
+ " <th>...</th>\n",
210
+ " <th>LDL</th>\n",
211
+ " <th>hemoglobin</th>\n",
212
+ " <th>Urine protein</th>\n",
213
+ " <th>serum creatinine</th>\n",
214
+ " <th>AST</th>\n",
215
+ " <th>ALT</th>\n",
216
+ " <th>Gtp</th>\n",
217
+ " <th>dental caries</th>\n",
218
+ " <th>smoking</th>\n",
219
+ " <th>Source</th>\n",
220
+ " </tr>\n",
221
+ " <tr>\n",
222
+ " <th>id</th>\n",
223
+ " <th></th>\n",
224
+ " <th></th>\n",
225
+ " <th></th>\n",
226
+ " <th></th>\n",
227
+ " <th></th>\n",
228
+ " <th></th>\n",
229
+ " <th></th>\n",
230
+ " <th></th>\n",
231
+ " <th></th>\n",
232
+ " <th></th>\n",
233
+ " <th></th>\n",
234
+ " <th></th>\n",
235
+ " <th></th>\n",
236
+ " <th></th>\n",
237
+ " <th></th>\n",
238
+ " <th></th>\n",
239
+ " <th></th>\n",
240
+ " <th></th>\n",
241
+ " <th></th>\n",
242
+ " <th></th>\n",
243
+ " <th></th>\n",
244
+ " </tr>\n",
245
+ " </thead>\n",
246
+ " <tbody>\n",
247
+ " <tr>\n",
248
+ " <th>0</th>\n",
249
+ " <td>55</td>\n",
250
+ " <td>165</td>\n",
251
+ " <td>60</td>\n",
252
+ " <td>81.0</td>\n",
253
+ " <td>0.5</td>\n",
254
+ " <td>0.6</td>\n",
255
+ " <td>1</td>\n",
256
+ " <td>1</td>\n",
257
+ " <td>135</td>\n",
258
+ " <td>87</td>\n",
259
+ " <td>...</td>\n",
260
+ " <td>75</td>\n",
261
+ " <td>16.5</td>\n",
262
+ " <td>1</td>\n",
263
+ " <td>1.0</td>\n",
264
+ " <td>22</td>\n",
265
+ " <td>25</td>\n",
266
+ " <td>27</td>\n",
267
+ " <td>0</td>\n",
268
+ " <td>1</td>\n",
269
+ " <td>1</td>\n",
270
+ " </tr>\n",
271
+ " <tr>\n",
272
+ " <th>1</th>\n",
273
+ " <td>70</td>\n",
274
+ " <td>165</td>\n",
275
+ " <td>65</td>\n",
276
+ " <td>89.0</td>\n",
277
+ " <td>0.6</td>\n",
278
+ " <td>0.7</td>\n",
279
+ " <td>2</td>\n",
280
+ " <td>2</td>\n",
281
+ " <td>146</td>\n",
282
+ " <td>83</td>\n",
283
+ " <td>...</td>\n",
284
+ " <td>126</td>\n",
285
+ " <td>16.2</td>\n",
286
+ " <td>1</td>\n",
287
+ " <td>1.1</td>\n",
288
+ " <td>27</td>\n",
289
+ " <td>23</td>\n",
290
+ " <td>37</td>\n",
291
+ " <td>1</td>\n",
292
+ " <td>0</td>\n",
293
+ " <td>1</td>\n",
294
+ " </tr>\n",
295
+ " <tr>\n",
296
+ " <th>2</th>\n",
297
+ " <td>20</td>\n",
298
+ " <td>170</td>\n",
299
+ " <td>75</td>\n",
300
+ " <td>81.0</td>\n",
301
+ " <td>0.4</td>\n",
302
+ " <td>0.5</td>\n",
303
+ " <td>1</td>\n",
304
+ " <td>1</td>\n",
305
+ " <td>118</td>\n",
306
+ " <td>75</td>\n",
307
+ " <td>...</td>\n",
308
+ " <td>93</td>\n",
309
+ " <td>17.4</td>\n",
310
+ " <td>1</td>\n",
311
+ " <td>0.8</td>\n",
312
+ " <td>27</td>\n",
313
+ " <td>31</td>\n",
314
+ " <td>53</td>\n",
315
+ " <td>0</td>\n",
316
+ " <td>1</td>\n",
317
+ " <td>1</td>\n",
318
+ " </tr>\n",
319
+ " <tr>\n",
320
+ " <th>3</th>\n",
321
+ " <td>35</td>\n",
322
+ " <td>180</td>\n",
323
+ " <td>95</td>\n",
324
+ " <td>105.0</td>\n",
325
+ " <td>1.5</td>\n",
326
+ " <td>1.2</td>\n",
327
+ " <td>1</td>\n",
328
+ " <td>1</td>\n",
329
+ " <td>131</td>\n",
330
+ " <td>88</td>\n",
331
+ " <td>...</td>\n",
332
+ " <td>102</td>\n",
333
+ " <td>15.9</td>\n",
334
+ " <td>1</td>\n",
335
+ " <td>1.0</td>\n",
336
+ " <td>20</td>\n",
337
+ " <td>27</td>\n",
338
+ " <td>30</td>\n",
339
+ " <td>1</td>\n",
340
+ " <td>0</td>\n",
341
+ " <td>1</td>\n",
342
+ " </tr>\n",
343
+ " <tr>\n",
344
+ " <th>4</th>\n",
345
+ " <td>30</td>\n",
346
+ " <td>165</td>\n",
347
+ " <td>60</td>\n",
348
+ " <td>80.5</td>\n",
349
+ " <td>1.5</td>\n",
350
+ " <td>1.0</td>\n",
351
+ " <td>1</td>\n",
352
+ " <td>1</td>\n",
353
+ " <td>121</td>\n",
354
+ " <td>76</td>\n",
355
+ " <td>...</td>\n",
356
+ " <td>93</td>\n",
357
+ " <td>15.4</td>\n",
358
+ " <td>1</td>\n",
359
+ " <td>0.8</td>\n",
360
+ " <td>19</td>\n",
361
+ " <td>13</td>\n",
362
+ " <td>17</td>\n",
363
+ " <td>0</td>\n",
364
+ " <td>1</td>\n",
365
+ " <td>1</td>\n",
366
+ " </tr>\n",
367
+ " </tbody>\n",
368
+ "</table>\n",
369
+ "<p>5 rows × 24 columns</p>\n",
370
+ "</div>"
371
+ ],
372
+ "text/plain": [
373
+ " age height(cm) weight(kg) waist(cm) eyesight(left) eyesight(right) \\\n",
374
+ "id \n",
375
+ "0 55 165 60 81.0 0.5 0.6 \n",
376
+ "1 70 165 65 89.0 0.6 0.7 \n",
377
+ "2 20 170 75 81.0 0.4 0.5 \n",
378
+ "3 35 180 95 105.0 1.5 1.2 \n",
379
+ "4 30 165 60 80.5 1.5 1.0 \n",
380
+ "\n",
381
+ " hearing(left) hearing(right) systolic relaxation ... LDL hemoglobin \\\n",
382
+ "id ... \n",
383
+ "0 1 1 135 87 ... 75 16.5 \n",
384
+ "1 2 2 146 83 ... 126 16.2 \n",
385
+ "2 1 1 118 75 ... 93 17.4 \n",
386
+ "3 1 1 131 88 ... 102 15.9 \n",
387
+ "4 1 1 121 76 ... 93 15.4 \n",
388
+ "\n",
389
+ " Urine protein serum creatinine AST ALT Gtp dental caries smoking \\\n",
390
+ "id \n",
391
+ "0 1 1.0 22 25 27 0 1 \n",
392
+ "1 1 1.1 27 23 37 1 0 \n",
393
+ "2 1 0.8 27 31 53 0 1 \n",
394
+ "3 1 1.0 20 27 30 1 0 \n",
395
+ "4 1 0.8 19 13 17 0 1 \n",
396
+ "\n",
397
+ " Source \n",
398
+ "id \n",
399
+ "0 1 \n",
400
+ "1 1 \n",
401
+ "2 1 \n",
402
+ "3 1 \n",
403
+ "4 1 \n",
404
+ "\n",
405
+ "[5 rows x 24 columns]"
406
+ ]
407
+ },
408
+ "execution_count": 5,
409
+ "metadata": {},
410
+ "output_type": "execute_result"
411
+ }
412
+ ],
413
+ "source": [
414
+ "pp = DataLoader()\n",
415
+ "pp.execute()\n",
416
+ "pp.train.head()"
417
+ ]
418
+ },
419
+ {
420
+ "cell_type": "code",
421
+ "execution_count": 6,
422
+ "metadata": {
423
+ "execution": {
424
+ "iopub.execute_input": "2023-10-24T05:45:47.424378Z",
425
+ "iopub.status.busy": "2023-10-24T05:45:47.423944Z",
426
+ "iopub.status.idle": "2023-10-24T05:45:47.456140Z",
427
+ "shell.execute_reply": "2023-10-24T05:45:47.455321Z",
428
+ "shell.execute_reply.started": "2023-10-24T05:45:47.424342Z"
429
+ }
430
+ },
431
+ "outputs": [],
432
+ "source": [
433
+ "num,cat = pp.variables()"
434
+ ]
435
+ },
436
+ {
437
+ "cell_type": "code",
438
+ "execution_count": 7,
439
+ "metadata": {
440
+ "execution": {
441
+ "iopub.execute_input": "2023-10-24T05:45:55.533625Z",
442
+ "iopub.status.busy": "2023-10-24T05:45:55.533261Z",
443
+ "iopub.status.idle": "2023-10-24T05:45:55.538246Z",
444
+ "shell.execute_reply": "2023-10-24T05:45:55.537161Z",
445
+ "shell.execute_reply.started": "2023-10-24T05:45:55.533593Z"
446
+ }
447
+ },
448
+ "outputs": [],
449
+ "source": [
450
+ "cat.remove('Source')\n",
451
+ "cat.remove('smoking')"
452
+ ]
453
+ },
454
+ {
455
+ "cell_type": "markdown",
456
+ "metadata": {
457
+ "execution": {
458
+ "iopub.execute_input": "2023-10-24T05:45:22.405556Z",
459
+ "iopub.status.busy": "2023-10-24T05:45:22.405192Z",
460
+ "iopub.status.idle": "2023-10-24T05:45:22.412023Z",
461
+ "shell.execute_reply": "2023-10-24T05:45:22.410985Z",
462
+ "shell.execute_reply.started": "2023-10-24T05:45:22.405525Z"
463
+ }
464
+ },
465
+ "source": [
466
+ "## EDA and Graphs"
467
+ ]
468
+ },
469
+ {
470
+ "cell_type": "code",
471
+ "execution_count": 8,
472
+ "metadata": {
473
+ "execution": {
474
+ "iopub.execute_input": "2023-10-24T05:46:36.494735Z",
475
+ "iopub.status.busy": "2023-10-24T05:46:36.494364Z",
476
+ "iopub.status.idle": "2023-10-24T05:46:36.529709Z",
477
+ "shell.execute_reply": "2023-10-24T05:46:36.528579Z",
478
+ "shell.execute_reply.started": "2023-10-24T05:46:36.494705Z"
479
+ }
480
+ },
481
+ "outputs": [
482
+ {
483
+ "ename": "NameError",
484
+ "evalue": "name 'plt' is not defined",
485
+ "output_type": "error",
486
+ "traceback": [
487
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
488
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
489
+ "\u001b[0;32m<ipython-input-8-ff56c1381872>\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mfig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msubplots\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m6\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfigsize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m7\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m17\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mcol\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0max\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mzip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnumvars\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0maxs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mravel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mpp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrain\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcol\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdtype\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mfloat\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mpp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrain\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcol\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdtype\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0msns\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhistplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0max\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0max\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrain\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcol\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mbins\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m100\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mxlabel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcol\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
490
+ "\u001b[0;31mNameError\u001b[0m: name 'plt' is not defined"
491
+ ]
492
+ }
493
+ ],
494
+ "source": [
495
+ "fig, axs = plt.subplots(6, 3, figsize=(7, 17))\n",
496
+ "for col,ax in zip(numvars,axs.ravel()):\n",
497
+ " if pp.train[col].dtype == float or pp.train[col].dtype == int:\n",
498
+ " sns.histplot(ax = ax, data = pp.train[col],bins=100)\n",
499
+ " plt.xlabel(col)\n",
500
+ " ax.set_xticklabels(ax.get_xticklabels(),fontsize=0.1)\n",
501
+ " ax.set(xlim = (0,None),ylim = (0,None))\n",
502
+ " else:\n",
503
+ " vc = pp.train[col].value_counts()\n",
504
+ " ax.bar(vc.index,vc.values)\n",
505
+ " plt.xlabel(col)\n",
506
+ "fig.suptitle('Feature distributions', y=1.02, fontsize=20)\n",
507
+ "plt.tight_layout()"
508
+ ]
509
+ },
510
+ {
511
+ "cell_type": "code",
512
+ "execution_count": null,
513
+ "metadata": {},
514
+ "outputs": [],
515
+ "source": []
516
+ }
517
+ ],
518
+ "metadata": {
519
+ "kernelspec": {
520
+ "display_name": "Python 3",
521
+ "language": "python",
522
+ "name": "python3"
523
+ },
524
+ "language_info": {
525
+ "codemirror_mode": {
526
+ "name": "ipython",
527
+ "version": 3
528
+ },
529
+ "file_extension": ".py",
530
+ "mimetype": "text/x-python",
531
+ "name": "python",
532
+ "nbconvert_exporter": "python",
533
+ "pygments_lexer": "ipython3",
534
+ "version": "3.10.12"
535
+ }
536
+ },
537
+ "nbformat": 4,
538
+ "nbformat_minor": 4
539
+ }
benchmark/NBspecific_12/README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset Information
2
+
3
+
4
+
5
+ ## Dataset: Smoker Status Prediction using Bio-Signals
6
+
7
+ **Source:**
8
+ - **Title:** Smoker Status Prediction using Bio-Signals
9
+ - **URL:** [https://www.kaggle.com/datasets/gauravduttakiit/smoker-status-prediction-using-biosignals](https://www.kaggle.com/datasets/gauravduttakiit/smoker-status-prediction-using-biosignals)
10
+ - **Attribution:** Shared on Kaggle or other platform.
11
+
12
+ **License:**
13
+ - **License Type:** Apache 2.0
14
+ - **Summary:** Attribution and usage rules as specified by the dataset's license.
15
+
16
+
17
+
18
+ **How to Attribute:**
19
+ > "Smoker Status Prediction using Bio-Signals". Available at https://www.kaggle.com/datasets/gauravduttakiit/smoker-status-prediction-using-biosignals. Licensed under Apache 2.0.
20
+
21
+
22
+
23
+
24
+ ## Dataset: Binary Prediction of Smoker Status using Bio-Signals
25
+
26
+ **Source:**
27
+ - **Title:** Binary Prediction of Smoker Status using Bio-Signals
28
+ - **URL:** [https://www.kaggle.com/competitions/playground-series-s3e24/data](https://www.kaggle.com/competitions/playground-series-s3e24/data)
29
+ - **Attribution:** Shared on Kaggle or other platform.
30
+
31
+ **License:**
32
+ - **License Type:** Attribution 4.0 International (CC BY 4.0)
33
+ - **Summary:** Attribution and usage rules as specified by the dataset's license.
34
+
35
+
36
+
37
+ **How to Attribute:**
38
+ > "Binary Prediction of Smoker Status using Bio-Signals". Available at https://www.kaggle.com/competitions/playground-series-s3e24/data. Licensed under Attribution 4.0 International (CC BY 4.0).
39
+
40
+
41
+
{data → benchmark}/NBspecific_12/data/playground-series-s3e24/test.csv.zip RENAMED
File without changes
{data → benchmark}/NBspecific_12/data/playground-series-s3e24/train.csv.zip RENAMED
File without changes
{data → benchmark}/NBspecific_12/data/smoker-status-prediction-using-biosignals/test_dataset.csv.zip RENAMED
File without changes
{data → benchmark}/NBspecific_12/data/smoker-status-prediction-using-biosignals/train_dataset.csv.zip RENAMED
File without changes
benchmark/NBspecific_13/NBspecific_13.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":6409286,"sourceType":"datasetVersion","datasetId":3693593}],"dockerImageVersionId":30615,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"**** IsitCOM 2023 - Amel A.Chaieb - seance 1****","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nfrom matplotlib import pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2024-01-17T19:09:57.813684Z","iopub.execute_input":"2024-01-17T19:09:57.814079Z","iopub.status.idle":"2024-01-17T19:09:57.819260Z","shell.execute_reply.started":"2024-01-17T19:09:57.814048Z","shell.execute_reply":"2024-01-17T19:09:57.818258Z"},"trusted":true},"execution_count":25,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/basic-datasets/datareg_linear_300.csv\")\n","metadata":{"execution":{"iopub.status.busy":"2024-01-17T19:16:03.356007Z","iopub.execute_input":"2024-01-17T19:16:03.356409Z","iopub.status.idle":"2024-01-17T19:16:03.368615Z","shell.execute_reply.started":"2024-01-17T19:16:03.356375Z","shell.execute_reply":"2024-01-17T19:16:03.367406Z"},"trusted":true},"execution_count":29,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2024-01-17T19:16:05.137783Z","iopub.execute_input":"2024-01-17T19:16:05.138176Z","iopub.status.idle":"2024-01-17T19:16:05.150103Z","shell.execute_reply.started":"2024-01-17T19:16:05.138146Z","shell.execute_reply":"2024-01-17T19:16:05.149237Z"},"trusted":true},"execution_count":30,"outputs":[{"execution_count":30,"output_type":"execute_result","data":{"text/plain":" x y\n0 0.971633 22.979353\n1 0.929836 21.853771\n2 0.747121 22.750265\n3 0.249684 21.476546\n4 0.614170 22.498894","text/html":"<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>x</th>\n <th>y</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>0.971633</td>\n <td>22.979353</td>\n </tr>\n <tr>\n <th>1</th>\n <td>0.929836</td>\n <td>21.853771</td>\n </tr>\n <tr>\n <th>2</th>\n <td>0.747121</td>\n <td>22.750265</td>\n </tr>\n <tr>\n <th>3</th>\n <td>0.249684</td>\n <td>21.476546</td>\n </tr>\n <tr>\n <th>4</th>\n <td>0.614170</td>\n <td>22.498894</td>\n </tr>\n </tbody>\n</table>\n</div>"},"metadata":{}}]},{"cell_type":"code","source":"df[\"x\"]","metadata":{"trusted":true},"execution_count":31,"outputs":[{"execution_count":31,"output_type":"execute_result","data":{"text/plain":"0 0.971633\n1 0.929836\n2 0.747121\n3 0.249684\n4 0.614170\n ... \n295 0.686393\n296 0.426463\n297 0.057924\n298 0.044571\n299 0.631168\nName: x, Length: 300, dtype: float64"},"metadata":{}}]},{"cell_type":"code","source":"plt.scatter(df[\"x\"], df[\"y\"])\n\n","metadata":{"execution":{"iopub.status.busy":"2024-01-17T19:16:08.637018Z","iopub.execute_input":"2024-01-17T19:16:08.637427Z","iopub.status.idle":"2024-01-17T19:16:08.926652Z","shell.execute_reply.started":"2024-01-17T19:16:08.637395Z","shell.execute_reply":"2024-01-17T19:16:08.925511Z"},"trusted":true},"execution_count":32,"outputs":[{"execution_count":32,"output_type":"execute_result","data":{"text/plain":"<matplotlib.collections.PathCollection at 0x79d40b493940>"},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"<Figure size 640x480 with 1 Axes>","image/png":"iVBORw0KGgoAAAANSUhEUgAAAh8AAAGdCAYAAACyzRGfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8WgzjOAAAACXBIWXMAAA9hAAAPYQGoP6dpAABVz0lEQVR4nO3de3xV1Z03/s9JyN3khMBAggQICGqMilgQRFF4giIMYO1Mi7fRjtWqiaPYn1W0/IChLdixRZ9CsaLCzCDwtCqCwpMpCEihUBwg1RgUweCNBCcEckIgIeTs54+w47nsy1r7ds5JPu/Xy9dLkn3OXmefk7O+e63v+i6foigKiIiIiDySFOsGEBERUffC4IOIiIg8xeCDiIiIPMXgg4iIiDzF4IOIiIg8xeCDiIiIPMXgg4iIiDzF4IOIiIg81SPWDYgUDAZx9OhRZGdnw+fzxbo5REREJEBRFDQ1NaFfv35ISjIe24i74OPo0aMoLCyMdTOIiIjIgi+//BL9+/c3PCbugo/s7GwAHY3PycmJcWuIiIhIRCAQQGFhYWc/biTugg91qiUnJ4fBBxERUYIRSZlgwikRERF5isEHEREReYrBBxEREXmKwQcRERF5isEHEREReYrBBxEREXmKwQcRERF5isEHEREReSruiowRxZv2oII9NQ34pqkFfbLTMaooD8lJ3HeIiMgqBh9EBiqqajHv7WrUNrZ0/qzAn445U4sxqaQghi0jIkpcnHYh0lFRVYuHVu4LCzwAoK6xBQ+t3IeKqtoYtYyIKLEx+CDS0B5UMO/taigav1N/Nu/tarQHtY4gIiIjDD6INOypaYga8QilAKhtbMGemgbvGkVE1EUw+CDS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IPjWc6Ao6G5vDcFC86+8g6G6/96BpckKY9HcOt7omIuq5uN+2ixWz5ajCo4GfrqqI6bFl2kjtlE2a1WE1adVLostldh4+jLtCqe6wbNUiIiCj2uv3Ih9ny1QUbq1G2ar8jgQdgL7nT7vJSq0mrbuFW90RE3VO3HvkQKT2+7M81jhQayzcoBCbDzvLSeOvsudU9EVH31K2DD5FCYk6kG8wsHYryCUMdm8qwWiI83jr7WNUgISKi2OrW0y51Affv8H0A1rz/pevnEeFE0qqTuNU9EVH31K2DD3XzMjd5nUdhJB47e5ZJJyLqfrr1tEvo5mVui5ekSb2CY07lpFhtE8ukExF1H906+OiTI57bELm8VfpccZQ0GY+dPbe6JyLqPrpt8FFRVYu56z8yPa7An47ZU4oxf0O15V1uvcyjEMXOnoiIYqVbBh9qbQ+zkQwf0DkVcXNJx0jB5uo6vLLziNT5ZowcwCkEIiKi87pd8GFU2yNUQUQOhDpSMGZIL4wsyovKmTAyqHemzVYTERF1Hd1utYtIbQ8AeO4frtRNvlT3KJk95VKhc8ZTvgcREVGsdbvgQ3TVSX2z8TLc5CQf7h1bFFd1M4iIiBJBtws+nKzyGY91M4iIiOJdtws+nK7yySJZREREcrpdwqkTW9NHise6GURERPHKpyiKE5u2OiYQCMDv96OxsRE5OTmunaeiqjZqxUrkChciIiISI9N/d7uRDxVHK4iIiGKj2wYfAKt8EhERxUK3SzglIiKi2GLwQURERJ5i8EFERESeYvBBREREnmLwQURERJ5i8EFERESeYvBBREREnmLwQURERJ5i8EFERESeYvBBREREnmLwQURERJ5i8EFERESeYvBBREREnmLwQURERJ5i8EFERESeYvBBREREnmLwQURERJ5i8EFERESeYvBBREREnmLwQURERJ5i8EFERESeYvBBREREnmLwQURERJ5i8EFERESeYvBBREREnmLwQURERJ5i8EFERESeYvBBREREnmLwQURERJ5i8EFERESeYvBBREREnuoR6wYQxUp7UMGemgZ809SCPtnpGFWUh+QkX6ybRUTU5UmPfGzfvh1Tp05Fv3794PP58NZbb4X9/tSpUygvL0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7dqfueq1/aee+5RbrjhhqjHDB8+XElNTVUGDx6sLF++3NU2+hSFY1dERETknS6T80FERESJgcEHEREReYrBBxEREXmKwQcRERF5isEHEREReYrBBxEREXmKwQcRERF5isEHEREReYrBBxEREXmKwQcRERF5isEHEREReYrBBxEREXnq/wE0JotwJ6lGlQAAAABJRU5ErkJggg=="},"metadata":{}}]},{"cell_type":"code","source":"import numpy as np\nimport matplotlib.pyplot as plt\nimport pandas as pd\ndf = pd.read_csv(\"/kaggle/input/basic-datasets/datareg_linear_300.csv\")\n","metadata":{"execution":{"iopub.status.busy":"2024-01-17T19:20:15.247921Z","iopub.execute_input":"2024-01-17T19:20:15.248391Z","iopub.status.idle":"2024-01-17T19:20:15.256416Z","shell.execute_reply.started":"2024-01-17T19:20:15.248352Z","shell.execute_reply":"2024-01-17T19:20:15.255239Z"},"trusted":true},"execution_count":38,"outputs":[]},{"cell_type":"code","source":"class LinearRegression :\n def predict (self, x) :\n return self.a*x + self.b\n def fit (self, x, y):\n mx = x.mean()\n my= y.mean()\n self.a = np.sum((x - mx) * (y - my)) / np.sum((x - mx)**2)\n self.b = my - self.a +mx\n \n def score (self, y_hat , y):\n return 1 - np.sum((y_hat - y)**2) / np.sum((y - np.mean(y))**2)","metadata":{"execution":{"iopub.status.busy":"2024-01-17T19:22:24.332425Z","iopub.execute_input":"2024-01-17T19:22:24.332978Z","iopub.status.idle":"2024-01-17T19:22:24.344882Z","shell.execute_reply.started":"2024-01-17T19:22:24.332930Z","shell.execute_reply":"2024-01-17T19:22:24.343541Z"},"trusted":true},"execution_count":50,"outputs":[]},{"cell_type":"code","source":"x = df['x'].values\ny = df['y'].values\nmodel = LinearRegression()\nmodel.fit(x,y)\ny_hat = model.predict(x)\nmodel.score(y_hat,y)\nplt.scatter(x,y)\nplt.plot(x, model.a*x+model.b, \"red\")","metadata":{"execution":{"iopub.status.busy":"2024-01-17T19:22:14.234592Z","iopub.execute_input":"2024-01-17T19:22:14.234991Z","iopub.status.idle":"2024-01-17T19:22:14.526341Z","shell.execute_reply.started":"2024-01-17T19:22:14.234960Z","shell.execute_reply":"2024-01-17T19:22:14.524964Z"},"trusted":true},"execution_count":49,"outputs":[{"execution_count":49,"output_type":"execute_result","data":{"text/plain":"[<matplotlib.lines.Line2D at 0x79d40ad48160>]"},"metadata":{}},{"output_type":"display_data","data":{"text/plain":"<Figure size 640x480 with 1 Axes>","image/png":"iVBORw0KGgoAAAANSUhEUgAAAh8AAAGdCAYAAACyzRGfAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8WgzjOAAAACXBIWXMAAA9hAAAPYQGoP6dpAABfhUlEQVR4nO3deXxU1d0/8M8kZDeZECgkyBZZ1BgWoSARReEBQShgtQtu1T4tVE2sYh/LJgWKCvSxD1qhLqjQpwj8qoKA0LQgm1AoPkAqMbgAwY0EC4EkBBJC5v7+GG6YzNzl3HVmks/79fLVktyZe+bOZM73nvM93+ORJEkCERERkUtiwt0AIiIialkYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrWoW7AcF8Ph+OHz+O1NRUeDyecDeHiIiIBEiShOrqanTo0AExMdpjGxEXfBw/fhydOnUKdzOIiIjIhK+++godO3bUPCbigo/U1FQA/sanpaWFuTVEREQkoqqqCp06dWrsx7VEXPAhT7WkpaUx+CAiIooyIikTTDglIiIiVzH4ICIiIlcx+CAiIiJXMfggIiIiVzH4ICIiIlcx+CAiIiJXMfggIiIiVzH4ICIiIldFXJExokjT4JOwt7QC31bXol1qIgZmZyA2hvsOERGZxeCDSENhcRnmrC9BWWVt48+yvImYNTYHo3KzwtgyIqLoxWkXIhWFxWV4ePn+JoEHAJRX1uLh5ftRWFwWppYREUU3Bh9EChp8EuasL4Gk8Dv5Z3PWl6DBp3QEERFpYfBBpGBvaUXIiEcgCUBZZS32lla41ygiomaCwQeRgm+r1QMPM8cREdFlDD6IFLR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h0KjKNys3CiJxMTosQETVDLT74YNGpyBUb42HAR0TUDLX4aRcWnSIiInJXiw8+5KJTaoP5HvhXvbDoFBERkT1afPDBolNERETuavHBB8DVFURERG5q8QmnMq6uICIicgeDjwBcXUFEROQ8TrsQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasYfBAREZGrGHwQERGRqxh8EBERkasMBx87duzA2LFj0aFDB3g8Hrz77rshxxw6dAjjxo2D1+tFSkoKBgwYgC+//NKO9hIREVGUMxx81NTUoE+fPli8eLHi748cOYKbbroJ11xzDbZt24aPPvoIM2fORGJiouXGEhERUfTzSJIkmX6wx4M1a9bgjjvuaPzZhAkTEBcXhz//+c+mnrOqqgperxeVlZVIS0sz2zQiIiJykZH+29acD5/Phw0bNqBnz54YOXIk2rVrhxtuuEFxakZWV1eHqqqqJv8RERFR82Vr8PHtt9/i7NmzmD9/PkaNGoW///3v+P73v48777wT27dvV3zMvHnz4PV6G//r1KmTnU0iIiKiCGPrtMvx48dx5ZVX4u6778aKFSsajxs3bhxSUlKwcuXKkOeoq6tDXV1d47+rqqrQqVMnTrsQERFFESPTLq3sPHHbtm3RqlUr5OTkNPn5tddei507dyo+JiEhAQkJCXY2g4iIiCKYrdMu8fHxGDBgAD799NMmP//ss8/QpUsXO09FREREUcrw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p1awwfPlz3fSE/o59n2apVq+DxeHDHHXc428BmxOi1PnPmDPLz85GVlYWEhAT07NmT3x8CjF7n559/HldffTWSkpLQqVMnTJ48GbW1tS61Njrt2LEDY8eORYcOHeDxePDuu+/qPmbbtm3o168fEhIS0L17dyxbtszZRkrNyKpVq6T4+HjpjTfekD7++GNp4sSJUnp6unTixAnF43ft2iXFxsZKv/vd76SSkhLpqaeekuLi4qSDBw+63PLoYvQ633PPPdLixYulAwcOSIcOHZIefPBByev1Sl9//bXLLY8uRq+zrLS0VLryyiulm2++WRo/frw7jY1yRq91XV2d9N3vflcaPXq0tHPnTqm0tFTatm2bVFRU5HLLo4vR6/zmm29KCQkJ0ptvvimVlpZKf/vb36SsrCxp8uTJLrc8umzcuFGaMWOGtHr1agmAtGbNGs3jjx49KiUnJ0tPPPGEVFJSIr344otSbGysVFhY6Fgbm1XwMXDgQCk/P7/x3w0NDVKHDh2kefPmKR7/ox/9SBozZkyTn91www3SL37xC0fbGe2MXudgFy9elFJTU6U//elPTjWxWTBznS9evCjdeOON0muvvSY98MADDD4EGb3WL730knTVVVdJFy5ccKuJzYLR65yfny8NGzasyc+eeOIJafDgwY62szkRCT5+/etfS9ddd12Tn/34xz+WRo4c6Vi7ms20y4ULF7Bv3z4MHz688WcxMTEYPnw4du/erfiY3bt3NzkeAEaOHKl6PJm7zsHOnTuH+vp6ZGRkONXMqGf2Ov/2t79Fu3bt8LOf/cyNZjYLZq71unXrkJeXh/z8fLRv3x65ubl49tln0dDQ4Fazo46Z63zjjTdi3759jVMzR48excaNGzF69GhX2txShKMvjLiN5cw6efIkGhoa0L59+yY/b9++PT755BPFx5SXlyseX15e7lg7o52Z6xxsypQp6NChQ8iHnS4zc5137tyJ119/HUVFRS60sPkwc62PHj2KLVu24N5778XGjRtx+PBhPPLII6ivr8esWbPcaHbUMXOd77nnHpw8eRI33XQTJEnCxYsX8dBDD2H69OluNLnFUOsLq6qqcP78eSQlJdl+zmYz8kHRYf78+Vi1ahXWrFmDxMTEcDen2aiursb999+PJUuWoG3btuFuTrPn8/nQrl07vPrqq+jfvz9+/OMfY8aMGXj55ZfD3bRmZdu2bXj22Wfxxz/+Efv378fq1auxYcMGzJ07N9xNI4uazchH27ZtERsbixMnTjT5+YkTJ5CZman4mMzMTEPHk7nrLHvuuecwf/58bN68Gb1793aymVHP6HU+cuQIjh07hrFjxzb+zOfzAQBatWqFTz/9FN26dXO20VHKzGc6KysLcXFxiI2NbfzZtddei/Lycly4cAHx8fGOtjkambnOM2fOxP3334+f//znAIBevXqhpqYGkyZNwowZMxATw/tnO6j1hWlpaY6MegDNaOQjPj4e/fv3x/vvv9/4M5/Ph/fffx95eXmKj8nLy2tyPABs2rRJ9Xgyd50B4He/+x3mzp2LwsJCfPe733WjqVHN6HW+5pprcPDgQRQVFTX+N27cOAwdOhRFRUXo1KmTm82PKmY+04MHD8bhw4cbAzwA+Oyzz5CVlcXAQ4WZ63zu3LmQAEMO+CRuS2absPSFjqWyhsGqVaukhIQEadmyZVJJSYk0adIkKT09XSovL5ckSZLuv/9+aerUqY3H79q1S2rVqpX03HPPSYcOHZJmzZrFpbYCjF7n+fPnS/Hx8dLbb78tlZWVNf5XXV0drpcQFYxe52Bc7SLO6LX+8ssvpdTUVKmgoED69NNPpffee09q166d9PTTT4frJUQFo9d51qxZUmpqqrRy5Urp6NGj0t///nepW7du0o9+9KNwvYSoUF1dLR04cEA6cOCABED6n//5H+nAgQPSF198IUmSJE2dOlW6//77G4+Xl9o++eST0qFDh6TFixdzqa1RL774otS5c2cpPj5eGjhwoLRnz57G391yyy3SAw880OT4v/zlL1LPnj2l+Ph46brrrpM2bNjgcoujk5Hr3KVLFwlAyH+zZs1yv+FRxujnORCDD2OMXut//OMf0g033CAlJCRIV111lfTMM89IFy9edLnV0cfIda6vr5dmz54tdevWTUpMTJQ6deokPfLII9Lp06fdb3gU2bp1q+J3rnxtH3jgAemWW24JeUzfvn2l+Ph46aqrrpKWLl3qaBs9ksSxKyIiInJPs8n5ICIioujA4IOIiIhcxeCDiIiIXMXgg4iIiFzF4IOIiIhcxeCDiIiIXMXgg4iIiFzF4IOIiIhcxeCDiIiIXMXgg4iIiFzF4IOIiIhcxeCDiIiIXPX/ARnNBPVXWnEzAAAAAElFTkSuQmCC"},"metadata":{}}]},{"cell_type":"markdown","source":"# **Geysar**","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nfrom matplotlib import pyplot as plt\nimport seaborn as sns ","metadata":{"execution":{"iopub.status.busy":"2023-12-11T14:10:43.445112Z","iopub.execute_input":"2023-12-11T14:10:43.445789Z","iopub.status.idle":"2023-12-11T14:10:44.089060Z","shell.execute_reply.started":"2023-12-11T14:10:43.445746Z","shell.execute_reply":"2023-12-11T14:10:44.087785Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/basic-datasets/geyser.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-12-11T14:10:47.862807Z","iopub.execute_input":"2023-12-11T14:10:47.863376Z","iopub.status.idle":"2023-12-11T14:10:47.881196Z","shell.execute_reply.started":"2023-12-11T14:10:47.863340Z","shell.execute_reply":"2023-12-11T14:10:47.880326Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()\n","metadata":{"execution":{"iopub.status.busy":"2023-12-11T13:13:13.890016Z","iopub.execute_input":"2023-12-11T13:13:13.890435Z","iopub.status.idle":"2023-12-11T13:13:13.914374Z","shell.execute_reply.started":"2023-12-11T13:13:13.890402Z","shell.execute_reply":"2023-12-11T13:13:13.912867Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.shape","metadata":{"execution":{"iopub.status.busy":"2023-12-11T13:13:39.606834Z","iopub.execute_input":"2023-12-11T13:13:39.607283Z","iopub.status.idle":"2023-12-11T13:13:39.614589Z","shell.execute_reply.started":"2023-12-11T13:13:39.607236Z","shell.execute_reply":"2023-12-11T13:13:39.613463Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.columns","metadata":{"execution":{"iopub.status.busy":"2023-12-11T13:14:13.611559Z","iopub.execute_input":"2023-12-11T13:14:13.612051Z","iopub.status.idle":"2023-12-11T13:14:13.621584Z","shell.execute_reply.started":"2023-12-11T13:14:13.612014Z","shell.execute_reply":"2023-12-11T13:14:13.620114Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info","metadata":{"execution":{"iopub.status.busy":"2023-12-11T13:14:29.094849Z","iopub.execute_input":"2023-12-11T13:14:29.095380Z","iopub.status.idle":"2023-12-11T13:14:29.112598Z","shell.execute_reply.started":"2023-12-11T13:14:29.095335Z","shell.execute_reply":"2023-12-11T13:14:29.110741Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.describe()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.waiting","metadata":{"execution":{"iopub.status.busy":"2023-12-11T13:16:36.785903Z","iopub.execute_input":"2023-12-11T13:16:36.786371Z","iopub.status.idle":"2023-12-11T13:16:36.796542Z","shell.execute_reply.started":"2023-12-11T13:16:36.786334Z","shell.execute_reply":"2023-12-11T13:16:36.795299Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[\"waiting\"]","metadata":{"execution":{"iopub.status.busy":"2023-12-11T13:17:08.636329Z","iopub.execute_input":"2023-12-11T13:17:08.636759Z","iopub.status.idle":"2023-12-11T13:17:08.646311Z","shell.execute_reply.started":"2023-12-11T13:17:08.636724Z","shell.execute_reply":"2023-12-11T13:17:08.644919Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[\"kind\"].value_counts","metadata":{"execution":{"iopub.status.busy":"2023-12-11T13:17:27.938060Z","iopub.execute_input":"2023-12-11T13:17:27.938472Z","iopub.status.idle":"2023-12-11T13:17:27.948327Z","shell.execute_reply.started":"2023-12-11T13:17:27.938440Z","shell.execute_reply":"2023-12-11T13:17:27.947168Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[[\"duration\",\"waiting\"]]","metadata":{"execution":{"iopub.status.busy":"2023-12-11T13:18:35.099539Z","iopub.execute_input":"2023-12-11T13:18:35.100075Z","iopub.status.idle":"2023-12-11T13:18:35.131110Z","shell.execute_reply.started":"2023-12-11T13:18:35.100030Z","shell.execute_reply":"2023-12-11T13:18:35.129448Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.loc[3]","metadata":{"execution":{"iopub.status.busy":"2023-12-11T13:19:37.696489Z","iopub.execute_input":"2023-12-11T13:19:37.696887Z","iopub.status.idle":"2023-12-11T13:19:37.706014Z","shell.execute_reply.started":"2023-12-11T13:19:37.696851Z","shell.execute_reply":"2023-12-11T13:19:37.704412Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.drop([3,5])","metadata":{"execution":{"iopub.status.busy":"2023-12-11T14:10:54.822418Z","iopub.execute_input":"2023-12-11T14:10:54.822795Z","iopub.status.idle":"2023-12-11T14:10:54.855489Z","shell.execute_reply.started":"2023-12-11T14:10:54.822765Z","shell.execute_reply":"2023-12-11T14:10:54.854481Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y = df[\"kind\"]\nX = df.drop([\"kind\"], axis=1)","metadata":{"execution":{"iopub.status.busy":"2023-12-11T14:11:45.982772Z","iopub.execute_input":"2023-12-11T14:11:45.983169Z","iopub.status.idle":"2023-12-11T14:11:45.989868Z","shell.execute_reply.started":"2023-12-11T14:11:45.983136Z","shell.execute_reply":"2023-12-11T14:11:45.988746Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.linear_model import LogisticRegression\nmodel = LogisticRegression()\nmodel .fit(X,y)\ny_hat = model.predict(X)\nMODEL;SCORE(X,y)","metadata":{"execution":{"iopub.status.busy":"2023-12-11T14:13:09.968065Z","iopub.execute_input":"2023-12-11T14:13:09.968436Z","iopub.status.idle":"2023-12-11T14:13:09.994727Z","shell.execute_reply.started":"2023-12-11T14:13:09.968408Z","shell.execute_reply":"2023-12-11T14:13:09.993639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.metrics import accuracy_score","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Coeur**","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/basic-datasets/heart.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-12-12T08:22:09.635910Z","iopub.execute_input":"2023-12-12T08:22:09.636349Z","iopub.status.idle":"2023-12-12T08:22:09.670327Z","shell.execute_reply.started":"2023-12-12T08:22:09.636314Z","shell.execute_reply":"2023-12-12T08:22:09.668463Z"},"trusted":true},"execution_count":3,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)","Cell \u001b[0;32mIn[3], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m df \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/kaggle/input/basic-datasets/heart.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n","\u001b[0;31mNameError\u001b[0m: name 'pd' is not defined"],"ename":"NameError","evalue":"name 'pd' is not defined","output_type":"error"}]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2023-12-11T14:20:38.616428Z","iopub.execute_input":"2023-12-11T14:20:38.616852Z","iopub.status.idle":"2023-12-11T14:20:38.634739Z","shell.execute_reply.started":"2023-12-11T14:20:38.616816Z","shell.execute_reply":"2023-12-11T14:20:38.633574Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.tree import DecisionTreeClassifier\nmodel = DecisionTreeClassifier()\nmodel .fit(X,y)\ny_hat = model.predict(X)\nprint ( accuracy_score(y_hat,y))","metadata":{"execution":{"iopub.status.busy":"2023-12-12T08:18:23.919866Z","iopub.execute_input":"2023-12-12T08:18:23.920518Z","iopub.status.idle":"2023-12-12T08:18:26.175245Z","shell.execute_reply.started":"2023-12-12T08:18:23.920481Z","shell.execute_reply":"2023-12-12T08:18:26.173666Z"},"trusted":true},"execution_count":1,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)","Cell \u001b[0;32mIn[1], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01msklearn\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtree\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m DecisionTreeClassifier\n\u001b[1;32m 2\u001b[0m model \u001b[38;5;241m=\u001b[39m DecisionTreeClassifier()\n\u001b[0;32m----> 3\u001b[0m model \u001b[38;5;241m.\u001b[39mfit(\u001b[43mX\u001b[49m,y)\n\u001b[1;32m 4\u001b[0m y_hat \u001b[38;5;241m=\u001b[39m model\u001b[38;5;241m.\u001b[39mpredict(X)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28mprint\u001b[39m ( accuracy_score(y_hat,y))\n","\u001b[0;31mNameError\u001b[0m: name 'X' is not defined"],"ename":"NameError","evalue":"name 'X' is not defined","output_type":"error"}]},{"cell_type":"code","source":"df=pd.read_csv(\"/kaggle/input/basic-datasets/heart.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-12-12T08:22:00.994934Z","iopub.execute_input":"2023-12-12T08:22:00.995401Z","iopub.status.idle":"2023-12-12T08:22:01.032439Z","shell.execute_reply.started":"2023-12-12T08:22:00.995361Z","shell.execute_reply":"2023-12-12T08:22:01.031079Z"},"trusted":true},"execution_count":2,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)","Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m df\u001b[38;5;241m=\u001b[39m\u001b[43mpd\u001b[49m\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/kaggle/input/basic-datasets/heart.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n","\u001b[0;31mNameError\u001b[0m: name 'pd' is not defined"],"ename":"NameError","evalue":"name 'pd' is not defined","output_type":"error"}]},{"cell_type":"code","source":"df.head()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.columns\n","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"continuous_features= ['age', 'trtbps', 'chol' , 'thalachh',\n 'oldpeak']\n\ndiscrete_features= list(set(df.columns) - set(continuous_features) - {\"output\"})\n\nns.boxplot(data=df[continuous_features])\nsns.pairplot(data=df[continuous_features+[\"output\"]], hue=\"output\")\n\nsns.heatmap(abs(df[continuous_features].corr()))","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nfrom matplotlib import pyplot as plt\nimport seaborn as sns ","metadata":{"execution":{"iopub.status.busy":"2023-12-12T08:30:54.583147Z","iopub.execute_input":"2023-12-12T08:30:54.583574Z","iopub.status.idle":"2023-12-12T08:30:55.312173Z","shell.execute_reply.started":"2023-12-12T08:30:54.583543Z","shell.execute_reply":"2023-12-12T08:30:55.310948Z"},"trusted":true},"execution_count":8,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2023-12-12T08:30:58.418064Z","iopub.execute_input":"2023-12-12T08:30:58.419692Z","iopub.status.idle":"2023-12-12T08:30:58.456410Z","shell.execute_reply.started":"2023-12-12T08:30:58.419634Z","shell.execute_reply":"2023-12-12T08:30:58.455461Z"},"trusted":true},"execution_count":9,"outputs":[]},{"cell_type":"code","source":"y= df['output']\nx = df.drop(['output'],axis = 1)\nX_train , X_test, y_train , y_test = train_test_split(X,y)\nfrom sklearn.tree import DecisionTreeClassifier\n\nmodel = DecisionTreeClassifier\nmodel.fit(X_train , y_train)\ny_hat= model.predict (X_test)\nprint (accuracy_score (y_hat, y_test))","metadata":{"execution":{"iopub.status.busy":"2023-12-12T08:34:28.835996Z","iopub.execute_input":"2023-12-12T08:34:28.836419Z","iopub.status.idle":"2023-12-12T08:34:28.954294Z","shell.execute_reply.started":"2023-12-12T08:34:28.836381Z","shell.execute_reply":"2023-12-12T08:34:28.952812Z"},"trusted":true},"execution_count":16,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/core/indexes/base.py:3653\u001b[0m, in \u001b[0;36mIndex.get_loc\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 3652\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 3653\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_engine\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_loc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcasted_key\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3654\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/_libs/index.pyx:147\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/_libs/index.pyx:176\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n","File \u001b[0;32mpandas/_libs/hashtable_class_helper.pxi:7080\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n","File \u001b[0;32mpandas/_libs/hashtable_class_helper.pxi:7088\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n","\u001b[0;31mKeyError\u001b[0m: 'output'","\nThe above exception was the direct cause of the following exception:\n","\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)","Cell \u001b[0;32mIn[16], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m y\u001b[38;5;241m=\u001b[39m \u001b[43mdf\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43moutput\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 2\u001b[0m x \u001b[38;5;241m=\u001b[39m df\u001b[38;5;241m.\u001b[39mdrop([\u001b[38;5;124m'\u001b[39m\u001b[38;5;124moutput\u001b[39m\u001b[38;5;124m'\u001b[39m],axis \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m)\n\u001b[1;32m 3\u001b[0m X_train , X_test, y_train , y_test \u001b[38;5;241m=\u001b[39m train_test_split(X,y)\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/core/frame.py:3761\u001b[0m, in \u001b[0;36mDataFrame.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 3759\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcolumns\u001b[38;5;241m.\u001b[39mnlevels \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[1;32m 3760\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_getitem_multilevel(key)\n\u001b[0;32m-> 3761\u001b[0m indexer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcolumns\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_loc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 3762\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_integer(indexer):\n\u001b[1;32m 3763\u001b[0m indexer \u001b[38;5;241m=\u001b[39m [indexer]\n","File \u001b[0;32m/opt/conda/lib/python3.10/site-packages/pandas/core/indexes/base.py:3655\u001b[0m, in \u001b[0;36mIndex.get_loc\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 3653\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_engine\u001b[38;5;241m.\u001b[39mget_loc(casted_key)\n\u001b[1;32m 3654\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[0;32m-> 3655\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(key) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01merr\u001b[39;00m\n\u001b[1;32m 3656\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m:\n\u001b[1;32m 3657\u001b[0m \u001b[38;5;66;03m# If we have a listlike key, _check_indexing_error will raise\u001b[39;00m\n\u001b[1;32m 3658\u001b[0m \u001b[38;5;66;03m# InvalidIndexError. Otherwise we fall through and re-raise\u001b[39;00m\n\u001b[1;32m 3659\u001b[0m \u001b[38;5;66;03m# the TypeError.\u001b[39;00m\n\u001b[1;32m 3660\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_indexing_error(key)\n","\u001b[0;31mKeyError\u001b[0m: 'output'"],"ename":"KeyError","evalue":"'output'","output_type":"error"}]},{"cell_type":"code","source":"from sklearn.tree import DecisionTreeClassifier # Correction ici\n\n# Supposez que vous avez déjà défini X et y\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)\n\n# Utilisez DecisionTreeClassifier, pas DecisionTreefier\nmodel = DecisionTreeClassifier() # Correction ici\nmodel.fit(X_train, y_train)\n\ny_hat = model.predict(X_test)\nprint(accuracy_score(y_test, y_hat)) # Correction ici\n","metadata":{"execution":{"iopub.status.busy":"2023-12-12T08:32:34.424276Z","iopub.execute_input":"2023-12-12T08:32:34.424781Z","iopub.status.idle":"2023-12-12T08:32:34.463812Z","shell.execute_reply.started":"2023-12-12T08:32:34.424736Z","shell.execute_reply":"2023-12-12T08:32:34.462281Z"},"trusted":true},"execution_count":11,"outputs":[{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)","Cell \u001b[0;32mIn[11], line 4\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01msklearn\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mtree\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m DecisionTreeClassifier \u001b[38;5;66;03m# Correction ici\u001b[39;00m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;66;03m# Supposez que vous avez déjà défini X et y\u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m X_train, X_test, y_train, y_test \u001b[38;5;241m=\u001b[39m \u001b[43mtrain_test_split\u001b[49m(X, y, test_size\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m0.2\u001b[39m)\n\u001b[1;32m 6\u001b[0m \u001b[38;5;66;03m# Utilisez DecisionTreeClassifier, pas DecisionTreefier\u001b[39;00m\n\u001b[1;32m 7\u001b[0m model \u001b[38;5;241m=\u001b[39m DecisionTreeClassifier() \u001b[38;5;66;03m# Correction ici\u001b[39;00m\n","\u001b[0;31mNameError\u001b[0m: name 'train_test_split' is not defined"],"ename":"NameError","evalue":"name 'train_test_split' is not defined","output_type":"error"}]},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.metrics import accuracy_score\ndf=pd.read_csv(\"/kaggle/input/basic-datasets/heart.csv\")\n# Assuming df is your DataFrame containing the data\ny = df['output']\nX = df.drop(['output'], axis=1)\n\n# Split the data into training and testing sets\nX_train, X_test, y_train, y_test = train_test_split(X, y)\n\n# Create a Decision Tree classifier\nmodel = DecisionTreeClassifier()\n\n# Train the model\nmodel.fit(X_train, y_train)\n\n# Make predictions on the test set\ny_hat = model.predict(X_test)\n\n# Calculate and print the accuracy\naccuracy = accuracy_score(y_test, y_hat)\nprint(\"Accuracy:\", accuracy)\n","metadata":{"execution":{"iopub.status.busy":"2023-12-12T08:35:48.471060Z","iopub.execute_input":"2023-12-12T08:35:48.471762Z","iopub.status.idle":"2023-12-12T08:35:48.496759Z","shell.execute_reply.started":"2023-12-12T08:35:48.471721Z","shell.execute_reply":"2023-12-12T08:35:48.495909Z"},"trusted":true},"execution_count":18,"outputs":[{"name":"stdout","text":"Accuracy: 0.7763157894736842\n","output_type":"stream"}]},{"cell_type":"code","source":"from sklearn.model_selection import cross_val_score\ncross_val_score(model, X,y,cv=10 , scoring='accuracy').mean()","metadata":{"execution":{"iopub.status.busy":"2023-12-12T08:38:21.181505Z","iopub.execute_input":"2023-12-12T08:38:21.181940Z","iopub.status.idle":"2023-12-12T08:38:21.260533Z","shell.execute_reply.started":"2023-12-12T08:38:21.181903Z","shell.execute_reply":"2023-12-12T08:38:21.259326Z"},"trusted":true},"execution_count":21,"outputs":[{"execution_count":21,"output_type":"execute_result","data":{"text/plain":"0.7749462365591397"},"metadata":{}}]},{"cell_type":"code","source":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{
14
+ "execution": {
15
+ "iopub.execute_input": "2024-01-17T19:09:57.814079Z",
16
+ "iopub.status.busy": "2024-01-17T19:09:57.813684Z",
17
+ "iopub.status.idle": "2024-01-17T19:09:57.819260Z",
18
+ "shell.execute_reply": "2024-01-17T19:09:57.818258Z",
19
+ "shell.execute_reply.started": "2024-01-17T19:09:57.814048Z"
20
+ }
21
+ },
22
+ "outputs": [],
23
+ "source": [
24
+ "import pandas as pd\n",
25
+ "from matplotlib import pyplot as plt"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": null,
31
+ "metadata": {
32
+ "execution": {
33
+ "iopub.execute_input": "2024-01-17T19:16:03.356409Z",
34
+ "iopub.status.busy": "2024-01-17T19:16:03.356007Z",
35
+ "iopub.status.idle": "2024-01-17T19:16:03.368615Z",
36
+ "shell.execute_reply": "2024-01-17T19:16:03.367406Z",
37
+ "shell.execute_reply.started": "2024-01-17T19:16:03.356375Z"
38
+ }
39
+ },
40
+ "outputs": [],
41
+ "source": [
42
+ "df = pd.read_csv(\"data/datareg_linear_300.csv\")\n"
43
+ ]
44
+ },
45
+ {
46
+ "cell_type": "code",
47
+ "execution_count": null,
48
+ "metadata": {
49
+ "execution": {
50
+ "iopub.execute_input": "2024-01-17T19:16:05.138176Z",
51
+ "iopub.status.busy": "2024-01-17T19:16:05.137783Z",
52
+ "iopub.status.idle": "2024-01-17T19:16:05.150103Z",
53
+ "shell.execute_reply": "2024-01-17T19:16:05.149237Z",
54
+ "shell.execute_reply.started": "2024-01-17T19:16:05.138146Z"
55
+ }
56
+ },
57
+ "outputs": [],
58
+ "source": [
59
+ "df.head()"
60
+ ]
61
+ },
62
+ {
63
+ "cell_type": "code",
64
+ "execution_count": null,
65
+ "metadata": {},
66
+ "outputs": [],
67
+ "source": [
68
+ "df[\"x\"]"
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": null,
74
+ "metadata": {
75
+ "execution": {
76
+ "iopub.execute_input": "2024-01-17T19:16:08.637427Z",
77
+ "iopub.status.busy": "2024-01-17T19:16:08.637018Z",
78
+ "iopub.status.idle": "2024-01-17T19:16:08.926652Z",
79
+ "shell.execute_reply": "2024-01-17T19:16:08.925511Z",
80
+ "shell.execute_reply.started": "2024-01-17T19:16:08.637395Z"
81
+ }
82
+ },
83
+ "outputs": [],
84
+ "source": [
85
+ "plt.scatter(df[\"x\"], df[\"y\"])\n",
86
+ "\n"
87
+ ]
88
+ },
89
+ {
90
+ "cell_type": "code",
91
+ "execution_count": null,
92
+ "metadata": {
93
+ "execution": {
94
+ "iopub.execute_input": "2024-01-17T19:20:15.248391Z",
95
+ "iopub.status.busy": "2024-01-17T19:20:15.247921Z",
96
+ "iopub.status.idle": "2024-01-17T19:20:15.256416Z",
97
+ "shell.execute_reply": "2024-01-17T19:20:15.255239Z",
98
+ "shell.execute_reply.started": "2024-01-17T19:20:15.248352Z"
99
+ }
100
+ },
101
+ "outputs": [],
102
+ "source": [
103
+ "import numpy as np\n",
104
+ "import matplotlib.pyplot as plt\n",
105
+ "import pandas as pd\n",
106
+ "df = pd.read_csv(\"data/datareg_linear_300.csv\")\n"
107
+ ]
108
+ },
109
+ {
110
+ "cell_type": "code",
111
+ "execution_count": null,
112
+ "metadata": {
113
+ "execution": {
114
+ "iopub.execute_input": "2024-01-17T19:22:24.332978Z",
115
+ "iopub.status.busy": "2024-01-17T19:22:24.332425Z",
116
+ "iopub.status.idle": "2024-01-17T19:22:24.344882Z",
117
+ "shell.execute_reply": "2024-01-17T19:22:24.343541Z",
118
+ "shell.execute_reply.started": "2024-01-17T19:22:24.332930Z"
119
+ }
120
+ },
121
+ "outputs": [],
122
+ "source": [
123
+ "class LinearRegression :\n",
124
+ " def predict (self, x) :\n",
125
+ " return self.a*x + self.b\n",
126
+ " def fit (self, x, y):\n",
127
+ " mx = x.mean()\n",
128
+ " my= y.mean()\n",
129
+ " self.a = np.sum((x - mx) * (y - my)) / np.sum((x - mx)**2)\n",
130
+ " self.b = my - self.a +mx\n",
131
+ " \n",
132
+ " def score (self, y_hat , y):\n",
133
+ " return 1 - np.sum((y_hat - y)**2) / np.sum((y - np.mean(y))**2)"
134
+ ]
135
+ },
136
+ {
137
+ "cell_type": "code",
138
+ "execution_count": null,
139
+ "metadata": {
140
+ "execution": {
141
+ "iopub.execute_input": "2024-01-17T19:22:14.234991Z",
142
+ "iopub.status.busy": "2024-01-17T19:22:14.234592Z",
143
+ "iopub.status.idle": "2024-01-17T19:22:14.526341Z",
144
+ "shell.execute_reply": "2024-01-17T19:22:14.524964Z",
145
+ "shell.execute_reply.started": "2024-01-17T19:22:14.234960Z"
146
+ }
147
+ },
148
+ "outputs": [],
149
+ "source": [
150
+ "x = df['x'].values\n",
151
+ "y = df['y'].values\n",
152
+ "model = LinearRegression()\n",
153
+ "model.fit(x,y)\n",
154
+ "y_hat = model.predict(x)\n",
155
+ "model.score(y_hat,y)\n",
156
+ "plt.scatter(x,y)\n",
157
+ "plt.plot(x, model.a*x+model.b, \"red\")"
158
+ ]
159
+ },
160
+ {
161
+ "cell_type": "markdown",
162
+ "metadata": {},
163
+ "source": [
164
+ "# **Geysar**"
165
+ ]
166
+ },
167
+ {
168
+ "cell_type": "code",
169
+ "execution_count": null,
170
+ "metadata": {
171
+ "execution": {
172
+ "iopub.execute_input": "2023-12-11T14:10:43.445789Z",
173
+ "iopub.status.busy": "2023-12-11T14:10:43.445112Z",
174
+ "iopub.status.idle": "2023-12-11T14:10:44.089060Z",
175
+ "shell.execute_reply": "2023-12-11T14:10:44.087785Z",
176
+ "shell.execute_reply.started": "2023-12-11T14:10:43.445746Z"
177
+ }
178
+ },
179
+ "outputs": [],
180
+ "source": [
181
+ "import pandas as pd\n",
182
+ "from matplotlib import pyplot as plt\n",
183
+ "import seaborn as sns "
184
+ ]
185
+ },
186
+ {
187
+ "cell_type": "code",
188
+ "execution_count": null,
189
+ "metadata": {
190
+ "execution": {
191
+ "iopub.execute_input": "2023-12-11T14:10:47.863376Z",
192
+ "iopub.status.busy": "2023-12-11T14:10:47.862807Z",
193
+ "iopub.status.idle": "2023-12-11T14:10:47.881196Z",
194
+ "shell.execute_reply": "2023-12-11T14:10:47.880326Z",
195
+ "shell.execute_reply.started": "2023-12-11T14:10:47.863340Z"
196
+ }
197
+ },
198
+ "outputs": [],
199
+ "source": [
200
+ "df = pd.read_csv(\"data/geyser.csv\")"
201
+ ]
202
+ },
203
+ {
204
+ "cell_type": "code",
205
+ "execution_count": null,
206
+ "metadata": {
207
+ "execution": {
208
+ "iopub.execute_input": "2023-12-11T13:13:13.890435Z",
209
+ "iopub.status.busy": "2023-12-11T13:13:13.890016Z",
210
+ "iopub.status.idle": "2023-12-11T13:13:13.914374Z",
211
+ "shell.execute_reply": "2023-12-11T13:13:13.912867Z",
212
+ "shell.execute_reply.started": "2023-12-11T13:13:13.890402Z"
213
+ }
214
+ },
215
+ "outputs": [],
216
+ "source": [
217
+ "df.head()\n"
218
+ ]
219
+ },
220
+ {
221
+ "cell_type": "code",
222
+ "execution_count": null,
223
+ "metadata": {
224
+ "execution": {
225
+ "iopub.execute_input": "2023-12-11T13:13:39.607283Z",
226
+ "iopub.status.busy": "2023-12-11T13:13:39.606834Z",
227
+ "iopub.status.idle": "2023-12-11T13:13:39.614589Z",
228
+ "shell.execute_reply": "2023-12-11T13:13:39.613463Z",
229
+ "shell.execute_reply.started": "2023-12-11T13:13:39.607236Z"
230
+ }
231
+ },
232
+ "outputs": [],
233
+ "source": [
234
+ "df.shape"
235
+ ]
236
+ },
237
+ {
238
+ "cell_type": "code",
239
+ "execution_count": null,
240
+ "metadata": {
241
+ "execution": {
242
+ "iopub.execute_input": "2023-12-11T13:14:13.612051Z",
243
+ "iopub.status.busy": "2023-12-11T13:14:13.611559Z",
244
+ "iopub.status.idle": "2023-12-11T13:14:13.621584Z",
245
+ "shell.execute_reply": "2023-12-11T13:14:13.620114Z",
246
+ "shell.execute_reply.started": "2023-12-11T13:14:13.612014Z"
247
+ }
248
+ },
249
+ "outputs": [],
250
+ "source": [
251
+ "df.columns"
252
+ ]
253
+ },
254
+ {
255
+ "cell_type": "code",
256
+ "execution_count": null,
257
+ "metadata": {
258
+ "execution": {
259
+ "iopub.execute_input": "2023-12-11T13:14:29.095380Z",
260
+ "iopub.status.busy": "2023-12-11T13:14:29.094849Z",
261
+ "iopub.status.idle": "2023-12-11T13:14:29.112598Z",
262
+ "shell.execute_reply": "2023-12-11T13:14:29.110741Z",
263
+ "shell.execute_reply.started": "2023-12-11T13:14:29.095335Z"
264
+ }
265
+ },
266
+ "outputs": [],
267
+ "source": [
268
+ "df.info"
269
+ ]
270
+ },
271
+ {
272
+ "cell_type": "code",
273
+ "execution_count": null,
274
+ "metadata": {},
275
+ "outputs": [],
276
+ "source": [
277
+ "df.describe()"
278
+ ]
279
+ },
280
+ {
281
+ "cell_type": "code",
282
+ "execution_count": null,
283
+ "metadata": {
284
+ "execution": {
285
+ "iopub.execute_input": "2023-12-11T13:16:36.786371Z",
286
+ "iopub.status.busy": "2023-12-11T13:16:36.785903Z",
287
+ "iopub.status.idle": "2023-12-11T13:16:36.796542Z",
288
+ "shell.execute_reply": "2023-12-11T13:16:36.795299Z",
289
+ "shell.execute_reply.started": "2023-12-11T13:16:36.786334Z"
290
+ }
291
+ },
292
+ "outputs": [],
293
+ "source": [
294
+ "df.waiting"
295
+ ]
296
+ },
297
+ {
298
+ "cell_type": "code",
299
+ "execution_count": null,
300
+ "metadata": {
301
+ "execution": {
302
+ "iopub.execute_input": "2023-12-11T13:17:08.636759Z",
303
+ "iopub.status.busy": "2023-12-11T13:17:08.636329Z",
304
+ "iopub.status.idle": "2023-12-11T13:17:08.646311Z",
305
+ "shell.execute_reply": "2023-12-11T13:17:08.644919Z",
306
+ "shell.execute_reply.started": "2023-12-11T13:17:08.636724Z"
307
+ }
308
+ },
309
+ "outputs": [],
310
+ "source": [
311
+ "df[\"waiting\"]"
312
+ ]
313
+ },
314
+ {
315
+ "cell_type": "code",
316
+ "execution_count": null,
317
+ "metadata": {
318
+ "execution": {
319
+ "iopub.execute_input": "2023-12-11T13:17:27.938472Z",
320
+ "iopub.status.busy": "2023-12-11T13:17:27.938060Z",
321
+ "iopub.status.idle": "2023-12-11T13:17:27.948327Z",
322
+ "shell.execute_reply": "2023-12-11T13:17:27.947168Z",
323
+ "shell.execute_reply.started": "2023-12-11T13:17:27.938440Z"
324
+ }
325
+ },
326
+ "outputs": [],
327
+ "source": [
328
+ "df[\"kind\"].value_counts"
329
+ ]
330
+ },
331
+ {
332
+ "cell_type": "code",
333
+ "execution_count": null,
334
+ "metadata": {
335
+ "execution": {
336
+ "iopub.execute_input": "2023-12-11T13:18:35.100075Z",
337
+ "iopub.status.busy": "2023-12-11T13:18:35.099539Z",
338
+ "iopub.status.idle": "2023-12-11T13:18:35.131110Z",
339
+ "shell.execute_reply": "2023-12-11T13:18:35.129448Z",
340
+ "shell.execute_reply.started": "2023-12-11T13:18:35.100030Z"
341
+ }
342
+ },
343
+ "outputs": [],
344
+ "source": [
345
+ "df[[\"duration\",\"waiting\"]]"
346
+ ]
347
+ },
348
+ {
349
+ "cell_type": "code",
350
+ "execution_count": null,
351
+ "metadata": {
352
+ "execution": {
353
+ "iopub.execute_input": "2023-12-11T13:19:37.696887Z",
354
+ "iopub.status.busy": "2023-12-11T13:19:37.696489Z",
355
+ "iopub.status.idle": "2023-12-11T13:19:37.706014Z",
356
+ "shell.execute_reply": "2023-12-11T13:19:37.704412Z",
357
+ "shell.execute_reply.started": "2023-12-11T13:19:37.696851Z"
358
+ }
359
+ },
360
+ "outputs": [],
361
+ "source": [
362
+ "df.loc[3]"
363
+ ]
364
+ },
365
+ {
366
+ "cell_type": "code",
367
+ "execution_count": null,
368
+ "metadata": {
369
+ "execution": {
370
+ "iopub.execute_input": "2023-12-11T14:10:54.822795Z",
371
+ "iopub.status.busy": "2023-12-11T14:10:54.822418Z",
372
+ "iopub.status.idle": "2023-12-11T14:10:54.855489Z",
373
+ "shell.execute_reply": "2023-12-11T14:10:54.854481Z",
374
+ "shell.execute_reply.started": "2023-12-11T14:10:54.822765Z"
375
+ }
376
+ },
377
+ "outputs": [],
378
+ "source": [
379
+ "df.drop([3,5])"
380
+ ]
381
+ },
382
+ {
383
+ "cell_type": "code",
384
+ "execution_count": null,
385
+ "metadata": {
386
+ "execution": {
387
+ "iopub.execute_input": "2023-12-11T14:11:45.983169Z",
388
+ "iopub.status.busy": "2023-12-11T14:11:45.982772Z",
389
+ "iopub.status.idle": "2023-12-11T14:11:45.989868Z",
390
+ "shell.execute_reply": "2023-12-11T14:11:45.988746Z",
391
+ "shell.execute_reply.started": "2023-12-11T14:11:45.983136Z"
392
+ }
393
+ },
394
+ "outputs": [],
395
+ "source": [
396
+ "y = df[\"kind\"]\n",
397
+ "X = df.drop([\"kind\"], axis=1)"
398
+ ]
399
+ },
400
+ {
401
+ "cell_type": "code",
402
+ "execution_count": null,
403
+ "metadata": {
404
+ "execution": {
405
+ "iopub.execute_input": "2023-12-11T14:13:09.968436Z",
406
+ "iopub.status.busy": "2023-12-11T14:13:09.968065Z",
407
+ "iopub.status.idle": "2023-12-11T14:13:09.994727Z",
408
+ "shell.execute_reply": "2023-12-11T14:13:09.993639Z",
409
+ "shell.execute_reply.started": "2023-12-11T14:13:09.968408Z"
410
+ }
411
+ },
412
+ "outputs": [],
413
+ "source": [
414
+ "from sklearn.linear_model import LogisticRegression\n",
415
+ "model = LogisticRegression()\n",
416
+ "model .fit(X,y)\n",
417
+ "y_hat = model.predict(X)\n",
418
+ "MODEL;SCORE(X,y)"
419
+ ]
420
+ },
421
+ {
422
+ "cell_type": "code",
423
+ "execution_count": null,
424
+ "metadata": {},
425
+ "outputs": [],
426
+ "source": [
427
+ "from sklearn.metrics import accuracy_score"
428
+ ]
429
+ },
430
+ {
431
+ "cell_type": "code",
432
+ "execution_count": null,
433
+ "metadata": {},
434
+ "outputs": [],
435
+ "source": []
436
+ },
437
+ {
438
+ "cell_type": "code",
439
+ "execution_count": null,
440
+ "metadata": {},
441
+ "outputs": [],
442
+ "source": []
443
+ },
444
+ {
445
+ "cell_type": "markdown",
446
+ "metadata": {},
447
+ "source": [
448
+ "**Coeur**"
449
+ ]
450
+ },
451
+ {
452
+ "cell_type": "code",
453
+ "execution_count": 2,
454
+ "metadata": {
455
+ "execution": {
456
+ "iopub.execute_input": "2023-12-12T08:22:09.636349Z",
457
+ "iopub.status.busy": "2023-12-12T08:22:09.635910Z",
458
+ "iopub.status.idle": "2023-12-12T08:22:09.670327Z",
459
+ "shell.execute_reply": "2023-12-12T08:22:09.668463Z",
460
+ "shell.execute_reply.started": "2023-12-12T08:22:09.636314Z"
461
+ }
462
+ },
463
+ "outputs": [],
464
+ "source": [
465
+ "df = pd.read_csv(\"data/heart.csv\")"
466
+ ]
467
+ },
468
+ {
469
+ "cell_type": "code",
470
+ "execution_count": 3,
471
+ "metadata": {
472
+ "execution": {
473
+ "iopub.execute_input": "2023-12-11T14:20:38.616852Z",
474
+ "iopub.status.busy": "2023-12-11T14:20:38.616428Z",
475
+ "iopub.status.idle": "2023-12-11T14:20:38.634739Z",
476
+ "shell.execute_reply": "2023-12-11T14:20:38.633574Z",
477
+ "shell.execute_reply.started": "2023-12-11T14:20:38.616816Z"
478
+ }
479
+ },
480
+ "outputs": [
481
+ {
482
+ "data": {
483
+ "text/html": [
484
+ "<div>\n",
485
+ "<style scoped>\n",
486
+ " .dataframe tbody tr th:only-of-type {\n",
487
+ " vertical-align: middle;\n",
488
+ " }\n",
489
+ "\n",
490
+ " .dataframe tbody tr th {\n",
491
+ " vertical-align: top;\n",
492
+ " }\n",
493
+ "\n",
494
+ " .dataframe thead th {\n",
495
+ " text-align: right;\n",
496
+ " }\n",
497
+ "</style>\n",
498
+ "<table border=\"1\" class=\"dataframe\">\n",
499
+ " <thead>\n",
500
+ " <tr style=\"text-align: right;\">\n",
501
+ " <th></th>\n",
502
+ " <th>age</th>\n",
503
+ " <th>sex</th>\n",
504
+ " <th>cp</th>\n",
505
+ " <th>trtbps</th>\n",
506
+ " <th>chol</th>\n",
507
+ " <th>fbs</th>\n",
508
+ " <th>restecg</th>\n",
509
+ " <th>thalachh</th>\n",
510
+ " <th>exng</th>\n",
511
+ " <th>oldpeak</th>\n",
512
+ " <th>slp</th>\n",
513
+ " <th>caa</th>\n",
514
+ " <th>thall</th>\n",
515
+ " <th>output</th>\n",
516
+ " </tr>\n",
517
+ " </thead>\n",
518
+ " <tbody>\n",
519
+ " <tr>\n",
520
+ " <th>0</th>\n",
521
+ " <td>63</td>\n",
522
+ " <td>1</td>\n",
523
+ " <td>3</td>\n",
524
+ " <td>145</td>\n",
525
+ " <td>233</td>\n",
526
+ " <td>1</td>\n",
527
+ " <td>0</td>\n",
528
+ " <td>150</td>\n",
529
+ " <td>0</td>\n",
530
+ " <td>2.3</td>\n",
531
+ " <td>0</td>\n",
532
+ " <td>0</td>\n",
533
+ " <td>1</td>\n",
534
+ " <td>1</td>\n",
535
+ " </tr>\n",
536
+ " <tr>\n",
537
+ " <th>1</th>\n",
538
+ " <td>37</td>\n",
539
+ " <td>1</td>\n",
540
+ " <td>2</td>\n",
541
+ " <td>130</td>\n",
542
+ " <td>250</td>\n",
543
+ " <td>0</td>\n",
544
+ " <td>1</td>\n",
545
+ " <td>187</td>\n",
546
+ " <td>0</td>\n",
547
+ " <td>3.5</td>\n",
548
+ " <td>0</td>\n",
549
+ " <td>0</td>\n",
550
+ " <td>2</td>\n",
551
+ " <td>1</td>\n",
552
+ " </tr>\n",
553
+ " <tr>\n",
554
+ " <th>2</th>\n",
555
+ " <td>41</td>\n",
556
+ " <td>0</td>\n",
557
+ " <td>1</td>\n",
558
+ " <td>130</td>\n",
559
+ " <td>204</td>\n",
560
+ " <td>0</td>\n",
561
+ " <td>0</td>\n",
562
+ " <td>172</td>\n",
563
+ " <td>0</td>\n",
564
+ " <td>1.4</td>\n",
565
+ " <td>2</td>\n",
566
+ " <td>0</td>\n",
567
+ " <td>2</td>\n",
568
+ " <td>1</td>\n",
569
+ " </tr>\n",
570
+ " <tr>\n",
571
+ " <th>3</th>\n",
572
+ " <td>56</td>\n",
573
+ " <td>1</td>\n",
574
+ " <td>1</td>\n",
575
+ " <td>120</td>\n",
576
+ " <td>236</td>\n",
577
+ " <td>0</td>\n",
578
+ " <td>1</td>\n",
579
+ " <td>178</td>\n",
580
+ " <td>0</td>\n",
581
+ " <td>0.8</td>\n",
582
+ " <td>2</td>\n",
583
+ " <td>0</td>\n",
584
+ " <td>2</td>\n",
585
+ " <td>1</td>\n",
586
+ " </tr>\n",
587
+ " <tr>\n",
588
+ " <th>4</th>\n",
589
+ " <td>57</td>\n",
590
+ " <td>0</td>\n",
591
+ " <td>0</td>\n",
592
+ " <td>120</td>\n",
593
+ " <td>354</td>\n",
594
+ " <td>0</td>\n",
595
+ " <td>1</td>\n",
596
+ " <td>163</td>\n",
597
+ " <td>1</td>\n",
598
+ " <td>0.6</td>\n",
599
+ " <td>2</td>\n",
600
+ " <td>0</td>\n",
601
+ " <td>2</td>\n",
602
+ " <td>1</td>\n",
603
+ " </tr>\n",
604
+ " </tbody>\n",
605
+ "</table>\n",
606
+ "</div>"
607
+ ],
608
+ "text/plain": [
609
+ " age sex cp trtbps chol fbs restecg thalachh exng oldpeak slp \\\n",
610
+ "0 63 1 3 145 233 1 0 150 0 2.3 0 \n",
611
+ "1 37 1 2 130 250 0 1 187 0 3.5 0 \n",
612
+ "2 41 0 1 130 204 0 0 172 0 1.4 2 \n",
613
+ "3 56 1 1 120 236 0 1 178 0 0.8 2 \n",
614
+ "4 57 0 0 120 354 0 1 163 1 0.6 2 \n",
615
+ "\n",
616
+ " caa thall output \n",
617
+ "0 0 1 1 \n",
618
+ "1 0 2 1 \n",
619
+ "2 0 2 1 \n",
620
+ "3 0 2 1 \n",
621
+ "4 0 2 1 "
622
+ ]
623
+ },
624
+ "execution_count": 3,
625
+ "metadata": {},
626
+ "output_type": "execute_result"
627
+ }
628
+ ],
629
+ "source": [
630
+ "df.head()"
631
+ ]
632
+ },
633
+ {
634
+ "cell_type": "code",
635
+ "execution_count": 6,
636
+ "metadata": {
637
+ "execution": {
638
+ "iopub.execute_input": "2023-12-12T08:18:23.920518Z",
639
+ "iopub.status.busy": "2023-12-12T08:18:23.919866Z",
640
+ "iopub.status.idle": "2023-12-12T08:18:26.175245Z",
641
+ "shell.execute_reply": "2023-12-12T08:18:26.173666Z",
642
+ "shell.execute_reply.started": "2023-12-12T08:18:23.920481Z"
643
+ }
644
+ },
645
+ "outputs": [
646
+ {
647
+ "name": "stdout",
648
+ "output_type": "stream",
649
+ "text": [
650
+ "1.0\n"
651
+ ]
652
+ }
653
+ ],
654
+ "source": [
655
+ "from sklearn.tree import DecisionTreeClassifier\n",
656
+ "model = DecisionTreeClassifier()\n",
657
+ "model .fit(X,y)\n",
658
+ "y_hat = model.predict(X)\n",
659
+ "print ( accuracy_score(y_hat,y))"
660
+ ]
661
+ },
662
+ {
663
+ "cell_type": "code",
664
+ "execution_count": null,
665
+ "metadata": {
666
+ "execution": {
667
+ "iopub.execute_input": "2023-12-12T08:22:00.995401Z",
668
+ "iopub.status.busy": "2023-12-12T08:22:00.994934Z",
669
+ "iopub.status.idle": "2023-12-12T08:22:01.032439Z",
670
+ "shell.execute_reply": "2023-12-12T08:22:01.031079Z",
671
+ "shell.execute_reply.started": "2023-12-12T08:22:00.995361Z"
672
+ }
673
+ },
674
+ "outputs": [],
675
+ "source": [
676
+ "df=pd.read_csv(\"data/heart.csv\")"
677
+ ]
678
+ },
679
+ {
680
+ "cell_type": "code",
681
+ "execution_count": null,
682
+ "metadata": {},
683
+ "outputs": [],
684
+ "source": [
685
+ "df.head()"
686
+ ]
687
+ },
688
+ {
689
+ "cell_type": "code",
690
+ "execution_count": null,
691
+ "metadata": {},
692
+ "outputs": [],
693
+ "source": [
694
+ "df.columns\n"
695
+ ]
696
+ },
697
+ {
698
+ "cell_type": "code",
699
+ "execution_count": null,
700
+ "metadata": {},
701
+ "outputs": [],
702
+ "source": [
703
+ "continuous_features= ['age', 'trtbps', 'chol' , 'thalachh',\n",
704
+ " 'oldpeak']\n",
705
+ "\n",
706
+ "discrete_features= list(set(df.columns) - set(continuous_features) - {\"output\"})\n",
707
+ "\n",
708
+ "ns.boxplot(data=df[continuous_features])\n",
709
+ "sns.pairplot(data=df[continuous_features+[\"output\"]], hue=\"output\")\n",
710
+ "\n",
711
+ "sns.heatmap(abs(df[continuous_features].corr()))"
712
+ ]
713
+ },
714
+ {
715
+ "cell_type": "code",
716
+ "execution_count": null,
717
+ "metadata": {
718
+ "execution": {
719
+ "iopub.execute_input": "2023-12-12T08:30:54.583574Z",
720
+ "iopub.status.busy": "2023-12-12T08:30:54.583147Z",
721
+ "iopub.status.idle": "2023-12-12T08:30:55.312173Z",
722
+ "shell.execute_reply": "2023-12-12T08:30:55.310948Z",
723
+ "shell.execute_reply.started": "2023-12-12T08:30:54.583543Z"
724
+ }
725
+ },
726
+ "outputs": [],
727
+ "source": [
728
+ "import pandas as pd\n",
729
+ "from matplotlib import pyplot as plt\n",
730
+ "import seaborn as sns "
731
+ ]
732
+ },
733
+ {
734
+ "cell_type": "code",
735
+ "execution_count": null,
736
+ "metadata": {
737
+ "execution": {
738
+ "iopub.execute_input": "2023-12-12T08:30:58.419692Z",
739
+ "iopub.status.busy": "2023-12-12T08:30:58.418064Z",
740
+ "iopub.status.idle": "2023-12-12T08:30:58.456410Z",
741
+ "shell.execute_reply": "2023-12-12T08:30:58.455461Z",
742
+ "shell.execute_reply.started": "2023-12-12T08:30:58.419634Z"
743
+ }
744
+ },
745
+ "outputs": [],
746
+ "source": []
747
+ },
748
+ {
749
+ "cell_type": "code",
750
+ "execution_count": null,
751
+ "metadata": {
752
+ "execution": {
753
+ "iopub.execute_input": "2023-12-12T08:34:28.836419Z",
754
+ "iopub.status.busy": "2023-12-12T08:34:28.835996Z",
755
+ "iopub.status.idle": "2023-12-12T08:34:28.954294Z",
756
+ "shell.execute_reply": "2023-12-12T08:34:28.952812Z",
757
+ "shell.execute_reply.started": "2023-12-12T08:34:28.836381Z"
758
+ }
759
+ },
760
+ "outputs": [],
761
+ "source": [
762
+ "y= df['output']\n",
763
+ "x = df.drop(['output'],axis = 1)\n",
764
+ "X_train , X_test, y_train , y_test = train_test_split(X,y)\n",
765
+ "from sklearn.tree import DecisionTreeClassifier\n",
766
+ "\n",
767
+ "model = DecisionTreeClassifier\n",
768
+ "model.fit(X_train , y_train)\n",
769
+ "y_hat= model.predict (X_test)\n",
770
+ "print (accuracy_score (y_hat, y_test))"
771
+ ]
772
+ },
773
+ {
774
+ "cell_type": "code",
775
+ "execution_count": null,
776
+ "metadata": {
777
+ "execution": {
778
+ "iopub.execute_input": "2023-12-12T08:32:34.424781Z",
779
+ "iopub.status.busy": "2023-12-12T08:32:34.424276Z",
780
+ "iopub.status.idle": "2023-12-12T08:32:34.463812Z",
781
+ "shell.execute_reply": "2023-12-12T08:32:34.462281Z",
782
+ "shell.execute_reply.started": "2023-12-12T08:32:34.424736Z"
783
+ }
784
+ },
785
+ "outputs": [],
786
+ "source": [
787
+ "from sklearn.tree import DecisionTreeClassifier # Correction ici\n",
788
+ "\n",
789
+ "# Supposez que vous avez déjà défini X et y\n",
790
+ "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)\n",
791
+ "\n",
792
+ "# Utilisez DecisionTreeClassifier, pas DecisionTreefier\n",
793
+ "model = DecisionTreeClassifier() # Correction ici\n",
794
+ "model.fit(X_train, y_train)\n",
795
+ "\n",
796
+ "y_hat = model.predict(X_test)\n",
797
+ "print(accuracy_score(y_test, y_hat)) # Correction ici\n"
798
+ ]
799
+ },
800
+ {
801
+ "cell_type": "code",
802
+ "execution_count": 5,
803
+ "metadata": {
804
+ "execution": {
805
+ "iopub.execute_input": "2023-12-12T08:35:48.471762Z",
806
+ "iopub.status.busy": "2023-12-12T08:35:48.471060Z",
807
+ "iopub.status.idle": "2023-12-12T08:35:48.496759Z",
808
+ "shell.execute_reply": "2023-12-12T08:35:48.495909Z",
809
+ "shell.execute_reply.started": "2023-12-12T08:35:48.471721Z"
810
+ }
811
+ },
812
+ "outputs": [
813
+ {
814
+ "name": "stdout",
815
+ "output_type": "stream",
816
+ "text": [
817
+ "Accuracy: 0.75\n"
818
+ ]
819
+ }
820
+ ],
821
+ "source": [
822
+ "from sklearn.model_selection import train_test_split\n",
823
+ "from sklearn.tree import DecisionTreeClassifier\n",
824
+ "from sklearn.metrics import accuracy_score\n",
825
+ "df=pd.read_csv(\"data/heart.csv\")\n",
826
+ "# Assuming df is your DataFrame containing the data\n",
827
+ "y = df['output']\n",
828
+ "X = df.drop(['output'], axis=1)\n",
829
+ "\n",
830
+ "# Split the data into training and testing sets\n",
831
+ "X_train, X_test, y_train, y_test = train_test_split(X, y)\n",
832
+ "\n",
833
+ "# Create a Decision Tree classifier\n",
834
+ "model = DecisionTreeClassifier()\n",
835
+ "\n",
836
+ "# Train the model\n",
837
+ "model.fit(X_train, y_train)\n",
838
+ "\n",
839
+ "# Make predictions on the test set\n",
840
+ "y_hat = model.predict(X_test)\n",
841
+ "\n",
842
+ "# Calculate and print the accuracy\n",
843
+ "accuracy = accuracy_score(y_test, y_hat)\n",
844
+ "print(\"Accuracy:\", accuracy)\n"
845
+ ]
846
+ },
847
+ {
848
+ "cell_type": "code",
849
+ "execution_count": null,
850
+ "metadata": {
851
+ "execution": {
852
+ "iopub.execute_input": "2023-12-12T08:38:21.181940Z",
853
+ "iopub.status.busy": "2023-12-12T08:38:21.181505Z",
854
+ "iopub.status.idle": "2023-12-12T08:38:21.260533Z",
855
+ "shell.execute_reply": "2023-12-12T08:38:21.259326Z",
856
+ "shell.execute_reply.started": "2023-12-12T08:38:21.181903Z"
857
+ }
858
+ },
859
+ "outputs": [],
860
+ "source": [
861
+ "from sklearn.model_selection import cross_val_score\n",
862
+ "cross_val_score(model, X,y,cv=10 , scoring='accuracy').mean()"
863
+ ]
864
+ },
865
+ {
866
+ "cell_type": "code",
867
+ "execution_count": null,
868
+ "metadata": {},
869
+ "outputs": [],
870
+ "source": []
871
+ }
872
+ ],
873
+ "metadata": {
874
+ "kaggle": {
875
+ "accelerator": "none",
876
+ "dataSources": [
877
+ {
878
+ "datasetId": 3693593,
879
+ "sourceId": 6409286,
880
+ "sourceType": "datasetVersion"
881
+ }
882
+ ],
883
+ "dockerImageVersionId": 30615,
884
+ "isGpuEnabled": false,
885
+ "isInternetEnabled": false,
886
+ "language": "python",
887
+ "sourceType": "notebook"
888
+ },
889
+ "kernelspec": {
890
+ "display_name": "Python 3",
891
+ "language": "python",
892
+ "name": "python3"
893
+ },
894
+ "language_info": {
895
+ "codemirror_mode": {
896
+ "name": "ipython",
897
+ "version": 3
898
+ },
899
+ "file_extension": ".py",
900
+ "mimetype": "text/x-python",
901
+ "name": "python",
902
+ "nbconvert_exporter": "python",
903
+ "pygments_lexer": "ipython3",
904
+ "version": "3.10.12"
905
+ }
906
+ },
907
+ "nbformat": 4,
908
+ "nbformat_minor": 4
909
+ }
benchmark/NBspecific_13/NBspecific_13_reproduced.ipynb ADDED
@@ -0,0 +1,905 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "**** IsitCOM 2023 - Amel A.Chaieb - seance 1****"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": 1,
13
+ "metadata": {
14
+ "execution": {
15
+ "iopub.execute_input": "2024-01-17T19:09:57.814079Z",
16
+ "iopub.status.busy": "2024-01-17T19:09:57.813684Z",
17
+ "iopub.status.idle": "2024-01-17T19:09:57.819260Z",
18
+ "shell.execute_reply": "2024-01-17T19:09:57.818258Z",
19
+ "shell.execute_reply.started": "2024-01-17T19:09:57.814048Z"
20
+ }
21
+ },
22
+ "outputs": [],
23
+ "source": [
24
+ "import pandas as pd\n",
25
+ "from matplotlib import pyplot as plt"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": null,
31
+ "metadata": {
32
+ "execution": {
33
+ "iopub.execute_input": "2024-01-17T19:16:03.356409Z",
34
+ "iopub.status.busy": "2024-01-17T19:16:03.356007Z",
35
+ "iopub.status.idle": "2024-01-17T19:16:03.368615Z",
36
+ "shell.execute_reply": "2024-01-17T19:16:03.367406Z",
37
+ "shell.execute_reply.started": "2024-01-17T19:16:03.356375Z"
38
+ }
39
+ },
40
+ "outputs": [],
41
+ "source": [
42
+ "df = pd.read_csv(\"data/datareg_linear_300.csv\")\n"
43
+ ]
44
+ },
45
+ {
46
+ "cell_type": "code",
47
+ "execution_count": null,
48
+ "metadata": {
49
+ "execution": {
50
+ "iopub.execute_input": "2024-01-17T19:16:05.138176Z",
51
+ "iopub.status.busy": "2024-01-17T19:16:05.137783Z",
52
+ "iopub.status.idle": "2024-01-17T19:16:05.150103Z",
53
+ "shell.execute_reply": "2024-01-17T19:16:05.149237Z",
54
+ "shell.execute_reply.started": "2024-01-17T19:16:05.138146Z"
55
+ }
56
+ },
57
+ "outputs": [],
58
+ "source": [
59
+ "df.head()"
60
+ ]
61
+ },
62
+ {
63
+ "cell_type": "code",
64
+ "execution_count": null,
65
+ "metadata": {},
66
+ "outputs": [],
67
+ "source": [
68
+ "df[\"x\"]"
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": null,
74
+ "metadata": {
75
+ "execution": {
76
+ "iopub.execute_input": "2024-01-17T19:16:08.637427Z",
77
+ "iopub.status.busy": "2024-01-17T19:16:08.637018Z",
78
+ "iopub.status.idle": "2024-01-17T19:16:08.926652Z",
79
+ "shell.execute_reply": "2024-01-17T19:16:08.925511Z",
80
+ "shell.execute_reply.started": "2024-01-17T19:16:08.637395Z"
81
+ }
82
+ },
83
+ "outputs": [],
84
+ "source": [
85
+ "plt.scatter(df[\"x\"], df[\"y\"])\n",
86
+ "\n"
87
+ ]
88
+ },
89
+ {
90
+ "cell_type": "code",
91
+ "execution_count": null,
92
+ "metadata": {
93
+ "execution": {
94
+ "iopub.execute_input": "2024-01-17T19:20:15.248391Z",
95
+ "iopub.status.busy": "2024-01-17T19:20:15.247921Z",
96
+ "iopub.status.idle": "2024-01-17T19:20:15.256416Z",
97
+ "shell.execute_reply": "2024-01-17T19:20:15.255239Z",
98
+ "shell.execute_reply.started": "2024-01-17T19:20:15.248352Z"
99
+ }
100
+ },
101
+ "outputs": [],
102
+ "source": [
103
+ "import numpy as np\n",
104
+ "import matplotlib.pyplot as plt\n",
105
+ "import pandas as pd\n",
106
+ "df = pd.read_csv(\"data/datareg_linear_300.csv\")\n"
107
+ ]
108
+ },
109
+ {
110
+ "cell_type": "code",
111
+ "execution_count": null,
112
+ "metadata": {
113
+ "execution": {
114
+ "iopub.execute_input": "2024-01-17T19:22:24.332978Z",
115
+ "iopub.status.busy": "2024-01-17T19:22:24.332425Z",
116
+ "iopub.status.idle": "2024-01-17T19:22:24.344882Z",
117
+ "shell.execute_reply": "2024-01-17T19:22:24.343541Z",
118
+ "shell.execute_reply.started": "2024-01-17T19:22:24.332930Z"
119
+ }
120
+ },
121
+ "outputs": [],
122
+ "source": [
123
+ "class LinearRegression :\n",
124
+ " def predict (self, x) :\n",
125
+ " return self.a*x + self.b\n",
126
+ " def fit (self, x, y):\n",
127
+ " mx = x.mean()\n",
128
+ " my= y.mean()\n",
129
+ " self.a = np.sum((x - mx) * (y - my)) / np.sum((x - mx)**2)\n",
130
+ " self.b = my - self.a +mx\n",
131
+ " \n",
132
+ " def score (self, y_hat , y):\n",
133
+ " return 1 - np.sum((y_hat - y)**2) / np.sum((y - np.mean(y))**2)"
134
+ ]
135
+ },
136
+ {
137
+ "cell_type": "code",
138
+ "execution_count": null,
139
+ "metadata": {
140
+ "execution": {
141
+ "iopub.execute_input": "2024-01-17T19:22:14.234991Z",
142
+ "iopub.status.busy": "2024-01-17T19:22:14.234592Z",
143
+ "iopub.status.idle": "2024-01-17T19:22:14.526341Z",
144
+ "shell.execute_reply": "2024-01-17T19:22:14.524964Z",
145
+ "shell.execute_reply.started": "2024-01-17T19:22:14.234960Z"
146
+ }
147
+ },
148
+ "outputs": [],
149
+ "source": [
150
+ "x = df['x'].values\n",
151
+ "y = df['y'].values\n",
152
+ "model = LinearRegression()\n",
153
+ "model.fit(x,y)\n",
154
+ "y_hat = model.predict(x)\n",
155
+ "model.score(y_hat,y)\n",
156
+ "plt.scatter(x,y)\n",
157
+ "plt.plot(x, model.a*x+model.b, \"red\")"
158
+ ]
159
+ },
160
+ {
161
+ "cell_type": "markdown",
162
+ "metadata": {},
163
+ "source": [
164
+ "# **Geysar**"
165
+ ]
166
+ },
167
+ {
168
+ "cell_type": "code",
169
+ "execution_count": null,
170
+ "metadata": {
171
+ "execution": {
172
+ "iopub.execute_input": "2023-12-11T14:10:43.445789Z",
173
+ "iopub.status.busy": "2023-12-11T14:10:43.445112Z",
174
+ "iopub.status.idle": "2023-12-11T14:10:44.089060Z",
175
+ "shell.execute_reply": "2023-12-11T14:10:44.087785Z",
176
+ "shell.execute_reply.started": "2023-12-11T14:10:43.445746Z"
177
+ }
178
+ },
179
+ "outputs": [],
180
+ "source": [
181
+ "import pandas as pd\n",
182
+ "from matplotlib import pyplot as plt\n",
183
+ "import seaborn as sns "
184
+ ]
185
+ },
186
+ {
187
+ "cell_type": "code",
188
+ "execution_count": null,
189
+ "metadata": {
190
+ "execution": {
191
+ "iopub.execute_input": "2023-12-11T14:10:47.863376Z",
192
+ "iopub.status.busy": "2023-12-11T14:10:47.862807Z",
193
+ "iopub.status.idle": "2023-12-11T14:10:47.881196Z",
194
+ "shell.execute_reply": "2023-12-11T14:10:47.880326Z",
195
+ "shell.execute_reply.started": "2023-12-11T14:10:47.863340Z"
196
+ }
197
+ },
198
+ "outputs": [],
199
+ "source": [
200
+ "df = pd.read_csv(\"data/geyser.csv\")"
201
+ ]
202
+ },
203
+ {
204
+ "cell_type": "code",
205
+ "execution_count": null,
206
+ "metadata": {
207
+ "execution": {
208
+ "iopub.execute_input": "2023-12-11T13:13:13.890435Z",
209
+ "iopub.status.busy": "2023-12-11T13:13:13.890016Z",
210
+ "iopub.status.idle": "2023-12-11T13:13:13.914374Z",
211
+ "shell.execute_reply": "2023-12-11T13:13:13.912867Z",
212
+ "shell.execute_reply.started": "2023-12-11T13:13:13.890402Z"
213
+ }
214
+ },
215
+ "outputs": [],
216
+ "source": [
217
+ "df.head()\n"
218
+ ]
219
+ },
220
+ {
221
+ "cell_type": "code",
222
+ "execution_count": null,
223
+ "metadata": {
224
+ "execution": {
225
+ "iopub.execute_input": "2023-12-11T13:13:39.607283Z",
226
+ "iopub.status.busy": "2023-12-11T13:13:39.606834Z",
227
+ "iopub.status.idle": "2023-12-11T13:13:39.614589Z",
228
+ "shell.execute_reply": "2023-12-11T13:13:39.613463Z",
229
+ "shell.execute_reply.started": "2023-12-11T13:13:39.607236Z"
230
+ }
231
+ },
232
+ "outputs": [],
233
+ "source": [
234
+ "df.shape"
235
+ ]
236
+ },
237
+ {
238
+ "cell_type": "code",
239
+ "execution_count": null,
240
+ "metadata": {
241
+ "execution": {
242
+ "iopub.execute_input": "2023-12-11T13:14:13.612051Z",
243
+ "iopub.status.busy": "2023-12-11T13:14:13.611559Z",
244
+ "iopub.status.idle": "2023-12-11T13:14:13.621584Z",
245
+ "shell.execute_reply": "2023-12-11T13:14:13.620114Z",
246
+ "shell.execute_reply.started": "2023-12-11T13:14:13.612014Z"
247
+ }
248
+ },
249
+ "outputs": [],
250
+ "source": [
251
+ "df.columns"
252
+ ]
253
+ },
254
+ {
255
+ "cell_type": "code",
256
+ "execution_count": null,
257
+ "metadata": {
258
+ "execution": {
259
+ "iopub.execute_input": "2023-12-11T13:14:29.095380Z",
260
+ "iopub.status.busy": "2023-12-11T13:14:29.094849Z",
261
+ "iopub.status.idle": "2023-12-11T13:14:29.112598Z",
262
+ "shell.execute_reply": "2023-12-11T13:14:29.110741Z",
263
+ "shell.execute_reply.started": "2023-12-11T13:14:29.095335Z"
264
+ }
265
+ },
266
+ "outputs": [],
267
+ "source": [
268
+ "df.info"
269
+ ]
270
+ },
271
+ {
272
+ "cell_type": "code",
273
+ "execution_count": null,
274
+ "metadata": {},
275
+ "outputs": [],
276
+ "source": [
277
+ "df.describe()"
278
+ ]
279
+ },
280
+ {
281
+ "cell_type": "code",
282
+ "execution_count": null,
283
+ "metadata": {
284
+ "execution": {
285
+ "iopub.execute_input": "2023-12-11T13:16:36.786371Z",
286
+ "iopub.status.busy": "2023-12-11T13:16:36.785903Z",
287
+ "iopub.status.idle": "2023-12-11T13:16:36.796542Z",
288
+ "shell.execute_reply": "2023-12-11T13:16:36.795299Z",
289
+ "shell.execute_reply.started": "2023-12-11T13:16:36.786334Z"
290
+ }
291
+ },
292
+ "outputs": [],
293
+ "source": [
294
+ "df.waiting"
295
+ ]
296
+ },
297
+ {
298
+ "cell_type": "code",
299
+ "execution_count": null,
300
+ "metadata": {
301
+ "execution": {
302
+ "iopub.execute_input": "2023-12-11T13:17:08.636759Z",
303
+ "iopub.status.busy": "2023-12-11T13:17:08.636329Z",
304
+ "iopub.status.idle": "2023-12-11T13:17:08.646311Z",
305
+ "shell.execute_reply": "2023-12-11T13:17:08.644919Z",
306
+ "shell.execute_reply.started": "2023-12-11T13:17:08.636724Z"
307
+ }
308
+ },
309
+ "outputs": [],
310
+ "source": [
311
+ "df[\"waiting\"]"
312
+ ]
313
+ },
314
+ {
315
+ "cell_type": "code",
316
+ "execution_count": null,
317
+ "metadata": {
318
+ "execution": {
319
+ "iopub.execute_input": "2023-12-11T13:17:27.938472Z",
320
+ "iopub.status.busy": "2023-12-11T13:17:27.938060Z",
321
+ "iopub.status.idle": "2023-12-11T13:17:27.948327Z",
322
+ "shell.execute_reply": "2023-12-11T13:17:27.947168Z",
323
+ "shell.execute_reply.started": "2023-12-11T13:17:27.938440Z"
324
+ }
325
+ },
326
+ "outputs": [],
327
+ "source": [
328
+ "df[\"kind\"].value_counts"
329
+ ]
330
+ },
331
+ {
332
+ "cell_type": "code",
333
+ "execution_count": null,
334
+ "metadata": {
335
+ "execution": {
336
+ "iopub.execute_input": "2023-12-11T13:18:35.100075Z",
337
+ "iopub.status.busy": "2023-12-11T13:18:35.099539Z",
338
+ "iopub.status.idle": "2023-12-11T13:18:35.131110Z",
339
+ "shell.execute_reply": "2023-12-11T13:18:35.129448Z",
340
+ "shell.execute_reply.started": "2023-12-11T13:18:35.100030Z"
341
+ }
342
+ },
343
+ "outputs": [],
344
+ "source": [
345
+ "df[[\"duration\",\"waiting\"]]"
346
+ ]
347
+ },
348
+ {
349
+ "cell_type": "code",
350
+ "execution_count": null,
351
+ "metadata": {
352
+ "execution": {
353
+ "iopub.execute_input": "2023-12-11T13:19:37.696887Z",
354
+ "iopub.status.busy": "2023-12-11T13:19:37.696489Z",
355
+ "iopub.status.idle": "2023-12-11T13:19:37.706014Z",
356
+ "shell.execute_reply": "2023-12-11T13:19:37.704412Z",
357
+ "shell.execute_reply.started": "2023-12-11T13:19:37.696851Z"
358
+ }
359
+ },
360
+ "outputs": [],
361
+ "source": [
362
+ "df.loc[3]"
363
+ ]
364
+ },
365
+ {
366
+ "cell_type": "code",
367
+ "execution_count": null,
368
+ "metadata": {
369
+ "execution": {
370
+ "iopub.execute_input": "2023-12-11T14:10:54.822795Z",
371
+ "iopub.status.busy": "2023-12-11T14:10:54.822418Z",
372
+ "iopub.status.idle": "2023-12-11T14:10:54.855489Z",
373
+ "shell.execute_reply": "2023-12-11T14:10:54.854481Z",
374
+ "shell.execute_reply.started": "2023-12-11T14:10:54.822765Z"
375
+ }
376
+ },
377
+ "outputs": [],
378
+ "source": [
379
+ "df.drop([3,5])"
380
+ ]
381
+ },
382
+ {
383
+ "cell_type": "code",
384
+ "execution_count": null,
385
+ "metadata": {
386
+ "execution": {
387
+ "iopub.execute_input": "2023-12-11T14:11:45.983169Z",
388
+ "iopub.status.busy": "2023-12-11T14:11:45.982772Z",
389
+ "iopub.status.idle": "2023-12-11T14:11:45.989868Z",
390
+ "shell.execute_reply": "2023-12-11T14:11:45.988746Z",
391
+ "shell.execute_reply.started": "2023-12-11T14:11:45.983136Z"
392
+ }
393
+ },
394
+ "outputs": [],
395
+ "source": [
396
+ "y = df[\"kind\"]\n",
397
+ "X = df.drop([\"kind\"], axis=1)"
398
+ ]
399
+ },
400
+ {
401
+ "cell_type": "code",
402
+ "execution_count": null,
403
+ "metadata": {
404
+ "execution": {
405
+ "iopub.execute_input": "2023-12-11T14:13:09.968436Z",
406
+ "iopub.status.busy": "2023-12-11T14:13:09.968065Z",
407
+ "iopub.status.idle": "2023-12-11T14:13:09.994727Z",
408
+ "shell.execute_reply": "2023-12-11T14:13:09.993639Z",
409
+ "shell.execute_reply.started": "2023-12-11T14:13:09.968408Z"
410
+ }
411
+ },
412
+ "outputs": [],
413
+ "source": [
414
+ "from sklearn.linear_model import LogisticRegression\n",
415
+ "model = LogisticRegression()\n",
416
+ "model .fit(X,y)\n",
417
+ "y_hat = model.predict(X)\n",
418
+ "MODEL;SCORE(X,y)"
419
+ ]
420
+ },
421
+ {
422
+ "cell_type": "code",
423
+ "execution_count": null,
424
+ "metadata": {},
425
+ "outputs": [],
426
+ "source": [
427
+ "from sklearn.metrics import accuracy_score"
428
+ ]
429
+ },
430
+ {
431
+ "cell_type": "code",
432
+ "execution_count": null,
433
+ "metadata": {},
434
+ "outputs": [],
435
+ "source": []
436
+ },
437
+ {
438
+ "cell_type": "code",
439
+ "execution_count": null,
440
+ "metadata": {},
441
+ "outputs": [],
442
+ "source": []
443
+ },
444
+ {
445
+ "cell_type": "markdown",
446
+ "metadata": {},
447
+ "source": [
448
+ "**Coeur**"
449
+ ]
450
+ },
451
+ {
452
+ "cell_type": "code",
453
+ "execution_count": 3,
454
+ "metadata": {
455
+ "execution": {
456
+ "iopub.execute_input": "2023-12-12T08:22:09.636349Z",
457
+ "iopub.status.busy": "2023-12-12T08:22:09.635910Z",
458
+ "iopub.status.idle": "2023-12-12T08:22:09.670327Z",
459
+ "shell.execute_reply": "2023-12-12T08:22:09.668463Z",
460
+ "shell.execute_reply.started": "2023-12-12T08:22:09.636314Z"
461
+ }
462
+ },
463
+ "outputs": [],
464
+ "source": [
465
+ "df = pd.read_csv(\"data/heart.csv\")"
466
+ ]
467
+ },
468
+ {
469
+ "cell_type": "code",
470
+ "execution_count": 4,
471
+ "metadata": {
472
+ "execution": {
473
+ "iopub.execute_input": "2023-12-11T14:20:38.616852Z",
474
+ "iopub.status.busy": "2023-12-11T14:20:38.616428Z",
475
+ "iopub.status.idle": "2023-12-11T14:20:38.634739Z",
476
+ "shell.execute_reply": "2023-12-11T14:20:38.633574Z",
477
+ "shell.execute_reply.started": "2023-12-11T14:20:38.616816Z"
478
+ }
479
+ },
480
+ "outputs": [
481
+ {
482
+ "data": {
483
+ "text/html": [
484
+ "<div>\n",
485
+ "<style scoped>\n",
486
+ " .dataframe tbody tr th:only-of-type {\n",
487
+ " vertical-align: middle;\n",
488
+ " }\n",
489
+ "\n",
490
+ " .dataframe tbody tr th {\n",
491
+ " vertical-align: top;\n",
492
+ " }\n",
493
+ "\n",
494
+ " .dataframe thead th {\n",
495
+ " text-align: right;\n",
496
+ " }\n",
497
+ "</style>\n",
498
+ "<table border=\"1\" class=\"dataframe\">\n",
499
+ " <thead>\n",
500
+ " <tr style=\"text-align: right;\">\n",
501
+ " <th></th>\n",
502
+ " <th>age</th>\n",
503
+ " <th>sex</th>\n",
504
+ " <th>cp</th>\n",
505
+ " <th>trtbps</th>\n",
506
+ " <th>chol</th>\n",
507
+ " <th>fbs</th>\n",
508
+ " <th>restecg</th>\n",
509
+ " <th>thalachh</th>\n",
510
+ " <th>exng</th>\n",
511
+ " <th>oldpeak</th>\n",
512
+ " <th>slp</th>\n",
513
+ " <th>caa</th>\n",
514
+ " <th>thall</th>\n",
515
+ " <th>output</th>\n",
516
+ " </tr>\n",
517
+ " </thead>\n",
518
+ " <tbody>\n",
519
+ " <tr>\n",
520
+ " <th>0</th>\n",
521
+ " <td>63</td>\n",
522
+ " <td>1</td>\n",
523
+ " <td>3</td>\n",
524
+ " <td>145</td>\n",
525
+ " <td>233</td>\n",
526
+ " <td>1</td>\n",
527
+ " <td>0</td>\n",
528
+ " <td>150</td>\n",
529
+ " <td>0</td>\n",
530
+ " <td>2.3</td>\n",
531
+ " <td>0</td>\n",
532
+ " <td>0</td>\n",
533
+ " <td>1</td>\n",
534
+ " <td>1</td>\n",
535
+ " </tr>\n",
536
+ " <tr>\n",
537
+ " <th>1</th>\n",
538
+ " <td>37</td>\n",
539
+ " <td>1</td>\n",
540
+ " <td>2</td>\n",
541
+ " <td>130</td>\n",
542
+ " <td>250</td>\n",
543
+ " <td>0</td>\n",
544
+ " <td>1</td>\n",
545
+ " <td>187</td>\n",
546
+ " <td>0</td>\n",
547
+ " <td>3.5</td>\n",
548
+ " <td>0</td>\n",
549
+ " <td>0</td>\n",
550
+ " <td>2</td>\n",
551
+ " <td>1</td>\n",
552
+ " </tr>\n",
553
+ " <tr>\n",
554
+ " <th>2</th>\n",
555
+ " <td>41</td>\n",
556
+ " <td>0</td>\n",
557
+ " <td>1</td>\n",
558
+ " <td>130</td>\n",
559
+ " <td>204</td>\n",
560
+ " <td>0</td>\n",
561
+ " <td>0</td>\n",
562
+ " <td>172</td>\n",
563
+ " <td>0</td>\n",
564
+ " <td>1.4</td>\n",
565
+ " <td>2</td>\n",
566
+ " <td>0</td>\n",
567
+ " <td>2</td>\n",
568
+ " <td>1</td>\n",
569
+ " </tr>\n",
570
+ " <tr>\n",
571
+ " <th>3</th>\n",
572
+ " <td>56</td>\n",
573
+ " <td>1</td>\n",
574
+ " <td>1</td>\n",
575
+ " <td>120</td>\n",
576
+ " <td>236</td>\n",
577
+ " <td>0</td>\n",
578
+ " <td>1</td>\n",
579
+ " <td>178</td>\n",
580
+ " <td>0</td>\n",
581
+ " <td>0.8</td>\n",
582
+ " <td>2</td>\n",
583
+ " <td>0</td>\n",
584
+ " <td>2</td>\n",
585
+ " <td>1</td>\n",
586
+ " </tr>\n",
587
+ " <tr>\n",
588
+ " <th>4</th>\n",
589
+ " <td>57</td>\n",
590
+ " <td>0</td>\n",
591
+ " <td>0</td>\n",
592
+ " <td>120</td>\n",
593
+ " <td>354</td>\n",
594
+ " <td>0</td>\n",
595
+ " <td>1</td>\n",
596
+ " <td>163</td>\n",
597
+ " <td>1</td>\n",
598
+ " <td>0.6</td>\n",
599
+ " <td>2</td>\n",
600
+ " <td>0</td>\n",
601
+ " <td>2</td>\n",
602
+ " <td>1</td>\n",
603
+ " </tr>\n",
604
+ " </tbody>\n",
605
+ "</table>\n",
606
+ "</div>"
607
+ ],
608
+ "text/plain": [
609
+ " age sex cp trtbps chol fbs restecg thalachh exng oldpeak slp \\\n",
610
+ "0 63 1 3 145 233 1 0 150 0 2.3 0 \n",
611
+ "1 37 1 2 130 250 0 1 187 0 3.5 0 \n",
612
+ "2 41 0 1 130 204 0 0 172 0 1.4 2 \n",
613
+ "3 56 1 1 120 236 0 1 178 0 0.8 2 \n",
614
+ "4 57 0 0 120 354 0 1 163 1 0.6 2 \n",
615
+ "\n",
616
+ " caa thall output \n",
617
+ "0 0 1 1 \n",
618
+ "1 0 2 1 \n",
619
+ "2 0 2 1 \n",
620
+ "3 0 2 1 \n",
621
+ "4 0 2 1 "
622
+ ]
623
+ },
624
+ "execution_count": 4,
625
+ "metadata": {},
626
+ "output_type": "execute_result"
627
+ }
628
+ ],
629
+ "source": [
630
+ "df.head()"
631
+ ]
632
+ },
633
+ {
634
+ "cell_type": "code",
635
+ "execution_count": 5,
636
+ "metadata": {
637
+ "execution": {
638
+ "iopub.execute_input": "2023-12-12T08:18:23.920518Z",
639
+ "iopub.status.busy": "2023-12-12T08:18:23.919866Z",
640
+ "iopub.status.idle": "2023-12-12T08:18:26.175245Z",
641
+ "shell.execute_reply": "2023-12-12T08:18:26.173666Z",
642
+ "shell.execute_reply.started": "2023-12-12T08:18:23.920481Z"
643
+ }
644
+ },
645
+ "outputs": [
646
+ {
647
+ "ename": "NameError",
648
+ "evalue": "name 'X' is not defined",
649
+ "output_type": "error",
650
+ "traceback": [
651
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
652
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
653
+ "\u001b[0;32m<ipython-input-5-522783fb824e>\u001b[0m in \u001b[0;36m<cell line: 3>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0msklearn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtree\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDecisionTreeClassifier\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDecisionTreeClassifier\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mmodel\u001b[0m \u001b[0;34m.\u001b[0m\u001b[0mfit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0my_hat\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmodel\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mprint\u001b[0m \u001b[0;34m(\u001b[0m \u001b[0maccuracy_score\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0my_hat\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
654
+ "\u001b[0;31mNameError\u001b[0m: name 'X' is not defined"
655
+ ]
656
+ }
657
+ ],
658
+ "source": [
659
+ "from sklearn.tree import DecisionTreeClassifier\n",
660
+ "model = DecisionTreeClassifier()\n",
661
+ "model .fit(X,y)\n",
662
+ "y_hat = model.predict(X)\n",
663
+ "print ( accuracy_score(y_hat,y))"
664
+ ]
665
+ },
666
+ {
667
+ "cell_type": "code",
668
+ "execution_count": null,
669
+ "metadata": {
670
+ "execution": {
671
+ "iopub.execute_input": "2023-12-12T08:22:00.995401Z",
672
+ "iopub.status.busy": "2023-12-12T08:22:00.994934Z",
673
+ "iopub.status.idle": "2023-12-12T08:22:01.032439Z",
674
+ "shell.execute_reply": "2023-12-12T08:22:01.031079Z",
675
+ "shell.execute_reply.started": "2023-12-12T08:22:00.995361Z"
676
+ }
677
+ },
678
+ "outputs": [],
679
+ "source": [
680
+ "df=pd.read_csv(\"data/heart.csv\")"
681
+ ]
682
+ },
683
+ {
684
+ "cell_type": "code",
685
+ "execution_count": null,
686
+ "metadata": {},
687
+ "outputs": [],
688
+ "source": [
689
+ "df.head()"
690
+ ]
691
+ },
692
+ {
693
+ "cell_type": "code",
694
+ "execution_count": null,
695
+ "metadata": {},
696
+ "outputs": [],
697
+ "source": [
698
+ "df.columns\n"
699
+ ]
700
+ },
701
+ {
702
+ "cell_type": "code",
703
+ "execution_count": null,
704
+ "metadata": {},
705
+ "outputs": [],
706
+ "source": [
707
+ "continuous_features= ['age', 'trtbps', 'chol' , 'thalachh',\n",
708
+ " 'oldpeak']\n",
709
+ "\n",
710
+ "discrete_features= list(set(df.columns) - set(continuous_features) - {\"output\"})\n",
711
+ "\n",
712
+ "ns.boxplot(data=df[continuous_features])\n",
713
+ "sns.pairplot(data=df[continuous_features+[\"output\"]], hue=\"output\")\n",
714
+ "\n",
715
+ "sns.heatmap(abs(df[continuous_features].corr()))"
716
+ ]
717
+ },
718
+ {
719
+ "cell_type": "code",
720
+ "execution_count": null,
721
+ "metadata": {
722
+ "execution": {
723
+ "iopub.execute_input": "2023-12-12T08:30:54.583574Z",
724
+ "iopub.status.busy": "2023-12-12T08:30:54.583147Z",
725
+ "iopub.status.idle": "2023-12-12T08:30:55.312173Z",
726
+ "shell.execute_reply": "2023-12-12T08:30:55.310948Z",
727
+ "shell.execute_reply.started": "2023-12-12T08:30:54.583543Z"
728
+ }
729
+ },
730
+ "outputs": [],
731
+ "source": [
732
+ "import pandas as pd\n",
733
+ "from matplotlib import pyplot as plt\n",
734
+ "import seaborn as sns "
735
+ ]
736
+ },
737
+ {
738
+ "cell_type": "code",
739
+ "execution_count": null,
740
+ "metadata": {
741
+ "execution": {
742
+ "iopub.execute_input": "2023-12-12T08:30:58.419692Z",
743
+ "iopub.status.busy": "2023-12-12T08:30:58.418064Z",
744
+ "iopub.status.idle": "2023-12-12T08:30:58.456410Z",
745
+ "shell.execute_reply": "2023-12-12T08:30:58.455461Z",
746
+ "shell.execute_reply.started": "2023-12-12T08:30:58.419634Z"
747
+ }
748
+ },
749
+ "outputs": [],
750
+ "source": []
751
+ },
752
+ {
753
+ "cell_type": "code",
754
+ "execution_count": null,
755
+ "metadata": {
756
+ "execution": {
757
+ "iopub.execute_input": "2023-12-12T08:34:28.836419Z",
758
+ "iopub.status.busy": "2023-12-12T08:34:28.835996Z",
759
+ "iopub.status.idle": "2023-12-12T08:34:28.954294Z",
760
+ "shell.execute_reply": "2023-12-12T08:34:28.952812Z",
761
+ "shell.execute_reply.started": "2023-12-12T08:34:28.836381Z"
762
+ }
763
+ },
764
+ "outputs": [],
765
+ "source": [
766
+ "y= df['output']\n",
767
+ "x = df.drop(['output'],axis = 1)\n",
768
+ "X_train , X_test, y_train , y_test = train_test_split(X,y)\n",
769
+ "from sklearn.tree import DecisionTreeClassifier\n",
770
+ "\n",
771
+ "model = DecisionTreeClassifier\n",
772
+ "model.fit(X_train , y_train)\n",
773
+ "y_hat= model.predict (X_test)\n",
774
+ "print (accuracy_score (y_hat, y_test))"
775
+ ]
776
+ },
777
+ {
778
+ "cell_type": "code",
779
+ "execution_count": null,
780
+ "metadata": {
781
+ "execution": {
782
+ "iopub.execute_input": "2023-12-12T08:32:34.424781Z",
783
+ "iopub.status.busy": "2023-12-12T08:32:34.424276Z",
784
+ "iopub.status.idle": "2023-12-12T08:32:34.463812Z",
785
+ "shell.execute_reply": "2023-12-12T08:32:34.462281Z",
786
+ "shell.execute_reply.started": "2023-12-12T08:32:34.424736Z"
787
+ }
788
+ },
789
+ "outputs": [],
790
+ "source": [
791
+ "from sklearn.tree import DecisionTreeClassifier # Correction ici\n",
792
+ "\n",
793
+ "# Supposez que vous avez déjà défini X et y\n",
794
+ "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)\n",
795
+ "\n",
796
+ "# Utilisez DecisionTreeClassifier, pas DecisionTreefier\n",
797
+ "model = DecisionTreeClassifier() # Correction ici\n",
798
+ "model.fit(X_train, y_train)\n",
799
+ "\n",
800
+ "y_hat = model.predict(X_test)\n",
801
+ "print(accuracy_score(y_test, y_hat)) # Correction ici\n"
802
+ ]
803
+ },
804
+ {
805
+ "cell_type": "code",
806
+ "execution_count": null,
807
+ "metadata": {
808
+ "execution": {
809
+ "iopub.execute_input": "2023-12-12T08:35:48.471762Z",
810
+ "iopub.status.busy": "2023-12-12T08:35:48.471060Z",
811
+ "iopub.status.idle": "2023-12-12T08:35:48.496759Z",
812
+ "shell.execute_reply": "2023-12-12T08:35:48.495909Z",
813
+ "shell.execute_reply.started": "2023-12-12T08:35:48.471721Z"
814
+ }
815
+ },
816
+ "outputs": [],
817
+ "source": [
818
+ "from sklearn.model_selection import train_test_split\n",
819
+ "from sklearn.tree import DecisionTreeClassifier\n",
820
+ "from sklearn.metrics import accuracy_score\n",
821
+ "df=pd.read_csv(\"data/heart.csv\")\n",
822
+ "# Assuming df is your DataFrame containing the data\n",
823
+ "y = df['output']\n",
824
+ "X = df.drop(['output'], axis=1)\n",
825
+ "\n",
826
+ "# Split the data into training and testing sets\n",
827
+ "X_train, X_test, y_train, y_test = train_test_split(X, y)\n",
828
+ "\n",
829
+ "# Create a Decision Tree classifier\n",
830
+ "model = DecisionTreeClassifier()\n",
831
+ "\n",
832
+ "# Train the model\n",
833
+ "model.fit(X_train, y_train)\n",
834
+ "\n",
835
+ "# Make predictions on the test set\n",
836
+ "y_hat = model.predict(X_test)\n",
837
+ "\n",
838
+ "# Calculate and print the accuracy\n",
839
+ "accuracy = accuracy_score(y_test, y_hat)\n",
840
+ "print(\"Accuracy:\", accuracy)\n"
841
+ ]
842
+ },
843
+ {
844
+ "cell_type": "code",
845
+ "execution_count": null,
846
+ "metadata": {
847
+ "execution": {
848
+ "iopub.execute_input": "2023-12-12T08:38:21.181940Z",
849
+ "iopub.status.busy": "2023-12-12T08:38:21.181505Z",
850
+ "iopub.status.idle": "2023-12-12T08:38:21.260533Z",
851
+ "shell.execute_reply": "2023-12-12T08:38:21.259326Z",
852
+ "shell.execute_reply.started": "2023-12-12T08:38:21.181903Z"
853
+ }
854
+ },
855
+ "outputs": [],
856
+ "source": [
857
+ "from sklearn.model_selection import cross_val_score\n",
858
+ "cross_val_score(model, X,y,cv=10 , scoring='accuracy').mean()"
859
+ ]
860
+ },
861
+ {
862
+ "cell_type": "code",
863
+ "execution_count": null,
864
+ "metadata": {},
865
+ "outputs": [],
866
+ "source": []
867
+ }
868
+ ],
869
+ "metadata": {
870
+ "kaggle": {
871
+ "accelerator": "none",
872
+ "dataSources": [
873
+ {
874
+ "datasetId": 3693593,
875
+ "sourceId": 6409286,
876
+ "sourceType": "datasetVersion"
877
+ }
878
+ ],
879
+ "dockerImageVersionId": 30615,
880
+ "isGpuEnabled": false,
881
+ "isInternetEnabled": false,
882
+ "language": "python",
883
+ "sourceType": "notebook"
884
+ },
885
+ "kernelspec": {
886
+ "display_name": "Python 3",
887
+ "language": "python",
888
+ "name": "python3"
889
+ },
890
+ "language_info": {
891
+ "codemirror_mode": {
892
+ "name": "ipython",
893
+ "version": 3
894
+ },
895
+ "file_extension": ".py",
896
+ "mimetype": "text/x-python",
897
+ "name": "python",
898
+ "nbconvert_exporter": "python",
899
+ "pygments_lexer": "ipython3",
900
+ "version": "3.10.12"
901
+ }
902
+ },
903
+ "nbformat": 4,
904
+ "nbformat_minor": 4
905
+ }
benchmark/NBspecific_13/README.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset Information
2
+
3
+
4
+
5
+ ## Dataset: Basic datasets
6
+
7
+ **Source:**
8
+ - **Title:** Basic datasets
9
+ - **URL:** [https://www.kaggle.com/datasets/pyim59/basic-datasets](https://www.kaggle.com/datasets/pyim59/basic-datasets)
10
+ - **Attribution:** Shared on Kaggle or other platform.
11
+
12
+ **License:**
13
+ - **License Type:** Unknown
14
+ - **Summary:** Attribution and usage rules as specified by the dataset's license.
15
+
16
+
17
+
{data → benchmark}/NBspecific_13/data/datareg_linear_300.csv RENAMED
File without changes
{data → benchmark}/NBspecific_13/data/geyser.csv RENAMED
File without changes
{data → benchmark}/NBspecific_13/data/heart.csv RENAMED
File without changes
benchmark/NBspecific_14/NBspecific_14.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n for filename in filenames:\n print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-08-14T22:27:08.074434Z","iopub.execute_input":"2023-08-14T22:27:08.075255Z","iopub.status.idle":"2023-08-14T22:27:08.121035Z","shell.execute_reply.started":"2023-08-14T22:27:08.075215Z","shell.execute_reply":"2023-08-14T22:27:08.119892Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_data = pd.read_csv(\"/kaggle/input/titanic/train.csv\")\ntrain_data.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-14T22:27:59.580932Z","iopub.execute_input":"2023-08-14T22:27:59.581351Z","iopub.status.idle":"2023-08-14T22:27:59.630183Z","shell.execute_reply.started":"2023-08-14T22:27:59.581317Z","shell.execute_reply":"2023-08-14T22:27:59.629013Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data = pd.read_csv(\"/kaggle/input/titanic/test.csv\")\ntest_data.head()","metadata":{"execution":{"iopub.status.busy":"2023-08-14T22:29:24.870122Z","iopub.execute_input":"2023-08-14T22:29:24.870572Z","iopub.status.idle":"2023-08-14T22:29:24.901707Z","shell.execute_reply.started":"2023-08-14T22:29:24.870535Z","shell.execute_reply":"2023-08-14T22:29:24.900785Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"women = train_data.loc[train_data.Sex == 'female'][\"Survived\"]\nrate_women = sum(women)/len(women)\n\nprint(\"% of women who survived:\", rate_women)","metadata":{"execution":{"iopub.status.busy":"2023-08-14T22:30:13.299142Z","iopub.execute_input":"2023-08-14T22:30:13.299598Z","iopub.status.idle":"2023-08-14T22:30:13.312376Z","shell.execute_reply.started":"2023-08-14T22:30:13.299556Z","shell.execute_reply":"2023-08-14T22:30:13.311510Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"men = train_data.loc[train_data.Sex == 'male'][\"Survived\"]\nrate_men = sum(men)/len(men)\n\nprint(\"% of men who survived:\", rate_men)","metadata":{"execution":{"iopub.status.busy":"2023-08-14T22:30:33.451680Z","iopub.execute_input":"2023-08-14T22:30:33.452100Z","iopub.status.idle":"2023-08-14T22:30:33.460724Z","shell.execute_reply.started":"2023-08-14T22:30:33.452066Z","shell.execute_reply":"2023-08-14T22:30:33.459372Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.ensemble import RandomForestClassifier\n\ny = train_data[\"Survived\"]\n\nfeatures = [\"Pclass\", \"Sex\", \"SibSp\", \"Parch\", \"Fare\"]\nX = pd.get_dummies(train_data[features])\nX_test = pd.get_dummies(test_data[features])\n\nmodel = RandomForestClassifier(n_estimators=100, max_depth=5, random_state=1)\nmodel.fit(X, y)\npredictions = model.predict(X_test)\n\noutput = pd.DataFrame({'PassengerId': test_data.PassengerId, 'Survived': predictions})\noutput.to_csv('submission.csv', index=False)\nprint(\"Your submission was successfully saved!\")","metadata":{"execution":{"iopub.status.busy":"2023-08-16T22:27:02.445420Z","iopub.execute_input":"2023-08-16T22:27:02.446192Z","iopub.status.idle":"2023-08-16T22:27:04.494809Z","shell.execute_reply.started":"2023-08-16T22:27:02.446156Z","shell.execute_reply":"2023-08-16T22:27:04.492102Z"},"trusted":true},"execution_count":1,"outputs":[{"name":"stderr","text":"/opt/conda/lib/python3.10/site-packages/scipy/__init__.py:146: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.23.5\n warnings.warn(f\"A NumPy version >={np_minversion} and <{np_maxversion}\"\n","output_type":"stream"},{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)","Cell \u001b[0;32mIn[1], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01msklearn\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mensemble\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m RandomForestClassifier\n\u001b[0;32m----> 3\u001b[0m y \u001b[38;5;241m=\u001b[39m \u001b[43mtrain_data\u001b[49m[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSurvived\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 5\u001b[0m features \u001b[38;5;241m=\u001b[39m [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mPclass\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSex\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSibSp\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mParch\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFare\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n\u001b[1;32m 6\u001b[0m X \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mget_dummies(train_data[features])\n","\u001b[0;31mNameError\u001b[0m: name 'train_data' is not defined"],"ename":"NameError","evalue":"name 'train_data' is not defined","output_type":"error"}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}
benchmark/NBspecific_14/NBspecific_14_fixed.ipynb ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {
7
+ "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
8
+ "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
9
+ "execution": {
10
+ "iopub.execute_input": "2023-08-14T22:27:08.075255Z",
11
+ "iopub.status.busy": "2023-08-14T22:27:08.074434Z",
12
+ "iopub.status.idle": "2023-08-14T22:27:08.121035Z",
13
+ "shell.execute_reply": "2023-08-14T22:27:08.119892Z",
14
+ "shell.execute_reply.started": "2023-08-14T22:27:08.075215Z"
15
+ }
16
+ },
17
+ "outputs": [
18
+ {
19
+ "name": "stdout",
20
+ "output_type": "stream",
21
+ "text": [
22
+ "data/test.csv\n",
23
+ "data/train.csv\n"
24
+ ]
25
+ }
26
+ ],
27
+ "source": [
28
+ "# This Python 3 environment comes with many helpful analytics libraries installed\n",
29
+ "# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n",
30
+ "# For example, here's several helpful packages to load\n",
31
+ "\n",
32
+ "import numpy as np # linear algebra\n",
33
+ "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
34
+ "\n",
35
+ "# Input data files are available in the read-only \"../input/\" directory\n",
36
+ "# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n",
37
+ "\n",
38
+ "import os\n",
39
+ "for dirname, _, filenames in os.walk('data'):\n",
40
+ " for filename in filenames:\n",
41
+ " print(os.path.join(dirname, filename))\n",
42
+ "\n",
43
+ "# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n",
44
+ "# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": 2,
50
+ "metadata": {
51
+ "execution": {
52
+ "iopub.execute_input": "2023-08-14T22:27:59.581351Z",
53
+ "iopub.status.busy": "2023-08-14T22:27:59.580932Z",
54
+ "iopub.status.idle": "2023-08-14T22:27:59.630183Z",
55
+ "shell.execute_reply": "2023-08-14T22:27:59.629013Z",
56
+ "shell.execute_reply.started": "2023-08-14T22:27:59.581317Z"
57
+ }
58
+ },
59
+ "outputs": [
60
+ {
61
+ "data": {
62
+ "text/html": [
63
+ "<div>\n",
64
+ "<style scoped>\n",
65
+ " .dataframe tbody tr th:only-of-type {\n",
66
+ " vertical-align: middle;\n",
67
+ " }\n",
68
+ "\n",
69
+ " .dataframe tbody tr th {\n",
70
+ " vertical-align: top;\n",
71
+ " }\n",
72
+ "\n",
73
+ " .dataframe thead th {\n",
74
+ " text-align: right;\n",
75
+ " }\n",
76
+ "</style>\n",
77
+ "<table border=\"1\" class=\"dataframe\">\n",
78
+ " <thead>\n",
79
+ " <tr style=\"text-align: right;\">\n",
80
+ " <th></th>\n",
81
+ " <th>PassengerId</th>\n",
82
+ " <th>Survived</th>\n",
83
+ " <th>Pclass</th>\n",
84
+ " <th>Name</th>\n",
85
+ " <th>Sex</th>\n",
86
+ " <th>Age</th>\n",
87
+ " <th>SibSp</th>\n",
88
+ " <th>Parch</th>\n",
89
+ " <th>Ticket</th>\n",
90
+ " <th>Fare</th>\n",
91
+ " <th>Cabin</th>\n",
92
+ " <th>Embarked</th>\n",
93
+ " </tr>\n",
94
+ " </thead>\n",
95
+ " <tbody>\n",
96
+ " <tr>\n",
97
+ " <th>0</th>\n",
98
+ " <td>1</td>\n",
99
+ " <td>0</td>\n",
100
+ " <td>3</td>\n",
101
+ " <td>Braund, Mr. Owen Harris</td>\n",
102
+ " <td>male</td>\n",
103
+ " <td>22.0</td>\n",
104
+ " <td>1</td>\n",
105
+ " <td>0</td>\n",
106
+ " <td>A/5 21171</td>\n",
107
+ " <td>7.2500</td>\n",
108
+ " <td>NaN</td>\n",
109
+ " <td>S</td>\n",
110
+ " </tr>\n",
111
+ " <tr>\n",
112
+ " <th>1</th>\n",
113
+ " <td>2</td>\n",
114
+ " <td>1</td>\n",
115
+ " <td>1</td>\n",
116
+ " <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
117
+ " <td>female</td>\n",
118
+ " <td>38.0</td>\n",
119
+ " <td>1</td>\n",
120
+ " <td>0</td>\n",
121
+ " <td>PC 17599</td>\n",
122
+ " <td>71.2833</td>\n",
123
+ " <td>C85</td>\n",
124
+ " <td>C</td>\n",
125
+ " </tr>\n",
126
+ " <tr>\n",
127
+ " <th>2</th>\n",
128
+ " <td>3</td>\n",
129
+ " <td>1</td>\n",
130
+ " <td>3</td>\n",
131
+ " <td>Heikkinen, Miss. Laina</td>\n",
132
+ " <td>female</td>\n",
133
+ " <td>26.0</td>\n",
134
+ " <td>0</td>\n",
135
+ " <td>0</td>\n",
136
+ " <td>STON/O2. 3101282</td>\n",
137
+ " <td>7.9250</td>\n",
138
+ " <td>NaN</td>\n",
139
+ " <td>S</td>\n",
140
+ " </tr>\n",
141
+ " <tr>\n",
142
+ " <th>3</th>\n",
143
+ " <td>4</td>\n",
144
+ " <td>1</td>\n",
145
+ " <td>1</td>\n",
146
+ " <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
147
+ " <td>female</td>\n",
148
+ " <td>35.0</td>\n",
149
+ " <td>1</td>\n",
150
+ " <td>0</td>\n",
151
+ " <td>113803</td>\n",
152
+ " <td>53.1000</td>\n",
153
+ " <td>C123</td>\n",
154
+ " <td>S</td>\n",
155
+ " </tr>\n",
156
+ " <tr>\n",
157
+ " <th>4</th>\n",
158
+ " <td>5</td>\n",
159
+ " <td>0</td>\n",
160
+ " <td>3</td>\n",
161
+ " <td>Allen, Mr. William Henry</td>\n",
162
+ " <td>male</td>\n",
163
+ " <td>35.0</td>\n",
164
+ " <td>0</td>\n",
165
+ " <td>0</td>\n",
166
+ " <td>373450</td>\n",
167
+ " <td>8.0500</td>\n",
168
+ " <td>NaN</td>\n",
169
+ " <td>S</td>\n",
170
+ " </tr>\n",
171
+ " </tbody>\n",
172
+ "</table>\n",
173
+ "</div>"
174
+ ],
175
+ "text/plain": [
176
+ " PassengerId Survived Pclass \\\n",
177
+ "0 1 0 3 \n",
178
+ "1 2 1 1 \n",
179
+ "2 3 1 3 \n",
180
+ "3 4 1 1 \n",
181
+ "4 5 0 3 \n",
182
+ "\n",
183
+ " Name Sex Age SibSp \\\n",
184
+ "0 Braund, Mr. Owen Harris male 22.0 1 \n",
185
+ "1 Cumings, Mrs. John Bradley (Florence Briggs Th... female 38.0 1 \n",
186
+ "2 Heikkinen, Miss. Laina female 26.0 0 \n",
187
+ "3 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35.0 1 \n",
188
+ "4 Allen, Mr. William Henry male 35.0 0 \n",
189
+ "\n",
190
+ " Parch Ticket Fare Cabin Embarked \n",
191
+ "0 0 A/5 21171 7.2500 NaN S \n",
192
+ "1 0 PC 17599 71.2833 C85 C \n",
193
+ "2 0 STON/O2. 3101282 7.9250 NaN S \n",
194
+ "3 0 113803 53.1000 C123 S \n",
195
+ "4 0 373450 8.0500 NaN S "
196
+ ]
197
+ },
198
+ "execution_count": 2,
199
+ "metadata": {},
200
+ "output_type": "execute_result"
201
+ }
202
+ ],
203
+ "source": [
204
+ "train_data = pd.read_csv(\"data/train.csv\")\n",
205
+ "train_data.head()"
206
+ ]
207
+ },
208
+ {
209
+ "cell_type": "code",
210
+ "execution_count": 3,
211
+ "metadata": {
212
+ "execution": {
213
+ "iopub.execute_input": "2023-08-14T22:29:24.870572Z",
214
+ "iopub.status.busy": "2023-08-14T22:29:24.870122Z",
215
+ "iopub.status.idle": "2023-08-14T22:29:24.901707Z",
216
+ "shell.execute_reply": "2023-08-14T22:29:24.900785Z",
217
+ "shell.execute_reply.started": "2023-08-14T22:29:24.870535Z"
218
+ }
219
+ },
220
+ "outputs": [
221
+ {
222
+ "data": {
223
+ "text/html": [
224
+ "<div>\n",
225
+ "<style scoped>\n",
226
+ " .dataframe tbody tr th:only-of-type {\n",
227
+ " vertical-align: middle;\n",
228
+ " }\n",
229
+ "\n",
230
+ " .dataframe tbody tr th {\n",
231
+ " vertical-align: top;\n",
232
+ " }\n",
233
+ "\n",
234
+ " .dataframe thead th {\n",
235
+ " text-align: right;\n",
236
+ " }\n",
237
+ "</style>\n",
238
+ "<table border=\"1\" class=\"dataframe\">\n",
239
+ " <thead>\n",
240
+ " <tr style=\"text-align: right;\">\n",
241
+ " <th></th>\n",
242
+ " <th>PassengerId</th>\n",
243
+ " <th>Pclass</th>\n",
244
+ " <th>Name</th>\n",
245
+ " <th>Sex</th>\n",
246
+ " <th>Age</th>\n",
247
+ " <th>SibSp</th>\n",
248
+ " <th>Parch</th>\n",
249
+ " <th>Ticket</th>\n",
250
+ " <th>Fare</th>\n",
251
+ " <th>Cabin</th>\n",
252
+ " <th>Embarked</th>\n",
253
+ " </tr>\n",
254
+ " </thead>\n",
255
+ " <tbody>\n",
256
+ " <tr>\n",
257
+ " <th>0</th>\n",
258
+ " <td>892</td>\n",
259
+ " <td>3</td>\n",
260
+ " <td>Kelly, Mr. James</td>\n",
261
+ " <td>male</td>\n",
262
+ " <td>34.5</td>\n",
263
+ " <td>0</td>\n",
264
+ " <td>0</td>\n",
265
+ " <td>330911</td>\n",
266
+ " <td>7.8292</td>\n",
267
+ " <td>NaN</td>\n",
268
+ " <td>Q</td>\n",
269
+ " </tr>\n",
270
+ " <tr>\n",
271
+ " <th>1</th>\n",
272
+ " <td>893</td>\n",
273
+ " <td>3</td>\n",
274
+ " <td>Wilkes, Mrs. James (Ellen Needs)</td>\n",
275
+ " <td>female</td>\n",
276
+ " <td>47.0</td>\n",
277
+ " <td>1</td>\n",
278
+ " <td>0</td>\n",
279
+ " <td>363272</td>\n",
280
+ " <td>7.0000</td>\n",
281
+ " <td>NaN</td>\n",
282
+ " <td>S</td>\n",
283
+ " </tr>\n",
284
+ " <tr>\n",
285
+ " <th>2</th>\n",
286
+ " <td>894</td>\n",
287
+ " <td>2</td>\n",
288
+ " <td>Myles, Mr. Thomas Francis</td>\n",
289
+ " <td>male</td>\n",
290
+ " <td>62.0</td>\n",
291
+ " <td>0</td>\n",
292
+ " <td>0</td>\n",
293
+ " <td>240276</td>\n",
294
+ " <td>9.6875</td>\n",
295
+ " <td>NaN</td>\n",
296
+ " <td>Q</td>\n",
297
+ " </tr>\n",
298
+ " <tr>\n",
299
+ " <th>3</th>\n",
300
+ " <td>895</td>\n",
301
+ " <td>3</td>\n",
302
+ " <td>Wirz, Mr. Albert</td>\n",
303
+ " <td>male</td>\n",
304
+ " <td>27.0</td>\n",
305
+ " <td>0</td>\n",
306
+ " <td>0</td>\n",
307
+ " <td>315154</td>\n",
308
+ " <td>8.6625</td>\n",
309
+ " <td>NaN</td>\n",
310
+ " <td>S</td>\n",
311
+ " </tr>\n",
312
+ " <tr>\n",
313
+ " <th>4</th>\n",
314
+ " <td>896</td>\n",
315
+ " <td>3</td>\n",
316
+ " <td>Hirvonen, Mrs. Alexander (Helga E Lindqvist)</td>\n",
317
+ " <td>female</td>\n",
318
+ " <td>22.0</td>\n",
319
+ " <td>1</td>\n",
320
+ " <td>1</td>\n",
321
+ " <td>3101298</td>\n",
322
+ " <td>12.2875</td>\n",
323
+ " <td>NaN</td>\n",
324
+ " <td>S</td>\n",
325
+ " </tr>\n",
326
+ " </tbody>\n",
327
+ "</table>\n",
328
+ "</div>"
329
+ ],
330
+ "text/plain": [
331
+ " PassengerId Pclass Name Sex \\\n",
332
+ "0 892 3 Kelly, Mr. James male \n",
333
+ "1 893 3 Wilkes, Mrs. James (Ellen Needs) female \n",
334
+ "2 894 2 Myles, Mr. Thomas Francis male \n",
335
+ "3 895 3 Wirz, Mr. Albert male \n",
336
+ "4 896 3 Hirvonen, Mrs. Alexander (Helga E Lindqvist) female \n",
337
+ "\n",
338
+ " Age SibSp Parch Ticket Fare Cabin Embarked \n",
339
+ "0 34.5 0 0 330911 7.8292 NaN Q \n",
340
+ "1 47.0 1 0 363272 7.0000 NaN S \n",
341
+ "2 62.0 0 0 240276 9.6875 NaN Q \n",
342
+ "3 27.0 0 0 315154 8.6625 NaN S \n",
343
+ "4 22.0 1 1 3101298 12.2875 NaN S "
344
+ ]
345
+ },
346
+ "execution_count": 3,
347
+ "metadata": {},
348
+ "output_type": "execute_result"
349
+ }
350
+ ],
351
+ "source": [
352
+ "test_data = pd.read_csv(\"data/test.csv\")\n",
353
+ "test_data.head()"
354
+ ]
355
+ },
356
+ {
357
+ "cell_type": "code",
358
+ "execution_count": 4,
359
+ "metadata": {
360
+ "execution": {
361
+ "iopub.execute_input": "2023-08-14T22:30:13.299598Z",
362
+ "iopub.status.busy": "2023-08-14T22:30:13.299142Z",
363
+ "iopub.status.idle": "2023-08-14T22:30:13.312376Z",
364
+ "shell.execute_reply": "2023-08-14T22:30:13.311510Z",
365
+ "shell.execute_reply.started": "2023-08-14T22:30:13.299556Z"
366
+ }
367
+ },
368
+ "outputs": [
369
+ {
370
+ "name": "stdout",
371
+ "output_type": "stream",
372
+ "text": [
373
+ "% of women who survived: 0.7420382165605095\n"
374
+ ]
375
+ }
376
+ ],
377
+ "source": [
378
+ "women = train_data.loc[train_data.Sex == 'female'][\"Survived\"]\n",
379
+ "rate_women = sum(women)/len(women)\n",
380
+ "\n",
381
+ "print(\"% of women who survived:\", rate_women)"
382
+ ]
383
+ },
384
+ {
385
+ "cell_type": "code",
386
+ "execution_count": 5,
387
+ "metadata": {
388
+ "execution": {
389
+ "iopub.execute_input": "2023-08-14T22:30:33.452100Z",
390
+ "iopub.status.busy": "2023-08-14T22:30:33.451680Z",
391
+ "iopub.status.idle": "2023-08-14T22:30:33.460724Z",
392
+ "shell.execute_reply": "2023-08-14T22:30:33.459372Z",
393
+ "shell.execute_reply.started": "2023-08-14T22:30:33.452066Z"
394
+ }
395
+ },
396
+ "outputs": [
397
+ {
398
+ "name": "stdout",
399
+ "output_type": "stream",
400
+ "text": [
401
+ "% of men who survived: 0.18890814558058924\n"
402
+ ]
403
+ }
404
+ ],
405
+ "source": [
406
+ "men = train_data.loc[train_data.Sex == 'male'][\"Survived\"]\n",
407
+ "rate_men = sum(men)/len(men)\n",
408
+ "\n",
409
+ "print(\"% of men who survived:\", rate_men)"
410
+ ]
411
+ },
412
+ {
413
+ "cell_type": "code",
414
+ "execution_count": 11,
415
+ "metadata": {
416
+ "execution": {
417
+ "iopub.execute_input": "2023-08-16T22:27:02.446192Z",
418
+ "iopub.status.busy": "2023-08-16T22:27:02.445420Z",
419
+ "iopub.status.idle": "2023-08-16T22:27:04.494809Z",
420
+ "shell.execute_reply": "2023-08-16T22:27:04.492102Z",
421
+ "shell.execute_reply.started": "2023-08-16T22:27:02.446156Z"
422
+ }
423
+ },
424
+ "outputs": [
425
+ {
426
+ "name": "stdout",
427
+ "output_type": "stream",
428
+ "text": [
429
+ "Your submission was successfully saved!\n"
430
+ ]
431
+ }
432
+ ],
433
+ "source": [
434
+ "from sklearn.ensemble import RandomForestClassifier\n",
435
+ "\n",
436
+ "y = train_data[\"Survived\"]\n",
437
+ "\n",
438
+ "features = [\"Pclass\", \"Sex\", \"SibSp\", \"Parch\", \"Fare\"]\n",
439
+ "X = pd.get_dummies(train_data[features])\n",
440
+ "X_test = pd.get_dummies(test_data[features])\n",
441
+ "\n",
442
+ "# fix additional crash------ X_test cannot contain Nan\n",
443
+ "X_test.fillna(0, inplace=True)\n",
444
+ "\n",
445
+ "model = RandomForestClassifier(n_estimators=100, max_depth=5, random_state=1)\n",
446
+ "model.fit(X, y)\n",
447
+ "predictions = model.predict(X_test)\n",
448
+ "\n",
449
+ "output = pd.DataFrame({'PassengerId': test_data.PassengerId, 'Survived': predictions})\n",
450
+ "# output.to_csv('submission.csv', index=False)\n",
451
+ "print(\"Your submission was successfully saved!\")"
452
+ ]
453
+ },
454
+ {
455
+ "cell_type": "code",
456
+ "execution_count": null,
457
+ "metadata": {},
458
+ "outputs": [],
459
+ "source": []
460
+ }
461
+ ],
462
+ "metadata": {
463
+ "kernelspec": {
464
+ "display_name": "Python 3",
465
+ "language": "python",
466
+ "name": "python3"
467
+ },
468
+ "language_info": {
469
+ "codemirror_mode": {
470
+ "name": "ipython",
471
+ "version": 3
472
+ },
473
+ "file_extension": ".py",
474
+ "mimetype": "text/x-python",
475
+ "name": "python",
476
+ "nbconvert_exporter": "python",
477
+ "pygments_lexer": "ipython3",
478
+ "version": "3.10.12"
479
+ }
480
+ },
481
+ "nbformat": 4,
482
+ "nbformat_minor": 4
483
+ }
benchmark/NBspecific_14/NBspecific_14_reproduced.ipynb ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {
7
+ "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19",
8
+ "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5",
9
+ "execution": {
10
+ "iopub.execute_input": "2023-08-14T22:27:08.075255Z",
11
+ "iopub.status.busy": "2023-08-14T22:27:08.074434Z",
12
+ "iopub.status.idle": "2023-08-14T22:27:08.121035Z",
13
+ "shell.execute_reply": "2023-08-14T22:27:08.119892Z",
14
+ "shell.execute_reply.started": "2023-08-14T22:27:08.075215Z"
15
+ }
16
+ },
17
+ "outputs": [
18
+ {
19
+ "name": "stdout",
20
+ "output_type": "stream",
21
+ "text": [
22
+ "data/test.csv\n",
23
+ "data/train.csv\n"
24
+ ]
25
+ }
26
+ ],
27
+ "source": [
28
+ "# This Python 3 environment comes with many helpful analytics libraries installed\n",
29
+ "# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n",
30
+ "# For example, here's several helpful packages to load\n",
31
+ "\n",
32
+ "import numpy as np # linear algebra\n",
33
+ "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
34
+ "\n",
35
+ "# Input data files are available in the read-only \"../input/\" directory\n",
36
+ "# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n",
37
+ "\n",
38
+ "import os\n",
39
+ "for dirname, _, filenames in os.walk('data'):\n",
40
+ " for filename in filenames:\n",
41
+ " print(os.path.join(dirname, filename))\n",
42
+ "\n",
43
+ "# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n",
44
+ "# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session"
45
+ ]
46
+ },
47
+ {
48
+ "cell_type": "code",
49
+ "execution_count": null,
50
+ "metadata": {
51
+ "execution": {
52
+ "iopub.execute_input": "2023-08-14T22:27:59.581351Z",
53
+ "iopub.status.busy": "2023-08-14T22:27:59.580932Z",
54
+ "iopub.status.idle": "2023-08-14T22:27:59.630183Z",
55
+ "shell.execute_reply": "2023-08-14T22:27:59.629013Z",
56
+ "shell.execute_reply.started": "2023-08-14T22:27:59.581317Z"
57
+ }
58
+ },
59
+ "outputs": [],
60
+ "source": [
61
+ "train_data = pd.read_csv(\"data/train.csv\")\n",
62
+ "train_data.head()"
63
+ ]
64
+ },
65
+ {
66
+ "cell_type": "code",
67
+ "execution_count": null,
68
+ "metadata": {
69
+ "execution": {
70
+ "iopub.execute_input": "2023-08-14T22:29:24.870572Z",
71
+ "iopub.status.busy": "2023-08-14T22:29:24.870122Z",
72
+ "iopub.status.idle": "2023-08-14T22:29:24.901707Z",
73
+ "shell.execute_reply": "2023-08-14T22:29:24.900785Z",
74
+ "shell.execute_reply.started": "2023-08-14T22:29:24.870535Z"
75
+ }
76
+ },
77
+ "outputs": [],
78
+ "source": [
79
+ "test_data = pd.read_csv(\"data/test.csv\")\n",
80
+ "test_data.head()"
81
+ ]
82
+ },
83
+ {
84
+ "cell_type": "code",
85
+ "execution_count": null,
86
+ "metadata": {
87
+ "execution": {
88
+ "iopub.execute_input": "2023-08-14T22:30:13.299598Z",
89
+ "iopub.status.busy": "2023-08-14T22:30:13.299142Z",
90
+ "iopub.status.idle": "2023-08-14T22:30:13.312376Z",
91
+ "shell.execute_reply": "2023-08-14T22:30:13.311510Z",
92
+ "shell.execute_reply.started": "2023-08-14T22:30:13.299556Z"
93
+ }
94
+ },
95
+ "outputs": [],
96
+ "source": [
97
+ "women = train_data.loc[train_data.Sex == 'female'][\"Survived\"]\n",
98
+ "rate_women = sum(women)/len(women)\n",
99
+ "\n",
100
+ "print(\"% of women who survived:\", rate_women)"
101
+ ]
102
+ },
103
+ {
104
+ "cell_type": "code",
105
+ "execution_count": null,
106
+ "metadata": {
107
+ "execution": {
108
+ "iopub.execute_input": "2023-08-14T22:30:33.452100Z",
109
+ "iopub.status.busy": "2023-08-14T22:30:33.451680Z",
110
+ "iopub.status.idle": "2023-08-14T22:30:33.460724Z",
111
+ "shell.execute_reply": "2023-08-14T22:30:33.459372Z",
112
+ "shell.execute_reply.started": "2023-08-14T22:30:33.452066Z"
113
+ }
114
+ },
115
+ "outputs": [],
116
+ "source": [
117
+ "men = train_data.loc[train_data.Sex == 'male'][\"Survived\"]\n",
118
+ "rate_men = sum(men)/len(men)\n",
119
+ "\n",
120
+ "print(\"% of men who survived:\", rate_men)"
121
+ ]
122
+ },
123
+ {
124
+ "cell_type": "code",
125
+ "execution_count": 2,
126
+ "metadata": {
127
+ "execution": {
128
+ "iopub.execute_input": "2023-08-16T22:27:02.446192Z",
129
+ "iopub.status.busy": "2023-08-16T22:27:02.445420Z",
130
+ "iopub.status.idle": "2023-08-16T22:27:04.494809Z",
131
+ "shell.execute_reply": "2023-08-16T22:27:04.492102Z",
132
+ "shell.execute_reply.started": "2023-08-16T22:27:02.446156Z"
133
+ }
134
+ },
135
+ "outputs": [
136
+ {
137
+ "ename": "NameError",
138
+ "evalue": "name 'train_data' is not defined",
139
+ "output_type": "error",
140
+ "traceback": [
141
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
142
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
143
+ "\u001b[0;32m<ipython-input-2-35e2f8bf0a65>\u001b[0m in \u001b[0;36m<cell line: 3>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0msklearn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mensemble\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mRandomForestClassifier\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0my\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtrain_data\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"Survived\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mfeatures\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m\"Pclass\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"Sex\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"SibSp\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"Parch\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"Fare\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
144
+ "\u001b[0;31mNameError\u001b[0m: name 'train_data' is not defined"
145
+ ]
146
+ }
147
+ ],
148
+ "source": [
149
+ "from sklearn.ensemble import RandomForestClassifier\n",
150
+ "\n",
151
+ "y = train_data[\"Survived\"]\n",
152
+ "\n",
153
+ "features = [\"Pclass\", \"Sex\", \"SibSp\", \"Parch\", \"Fare\"]\n",
154
+ "X = pd.get_dummies(train_data[features])\n",
155
+ "X_test = pd.get_dummies(test_data[features])\n",
156
+ "\n",
157
+ "model = RandomForestClassifier(n_estimators=100, max_depth=5, random_state=1)\n",
158
+ "model.fit(X, y)\n",
159
+ "predictions = model.predict(X_test)\n",
160
+ "\n",
161
+ "output = pd.DataFrame({'PassengerId': test_data.PassengerId, 'Survived': predictions})\n",
162
+ "output.to_csv('submission.csv', index=False)\n",
163
+ "print(\"Your submission was successfully saved!\")"
164
+ ]
165
+ },
166
+ {
167
+ "cell_type": "code",
168
+ "execution_count": null,
169
+ "metadata": {},
170
+ "outputs": [],
171
+ "source": []
172
+ }
173
+ ],
174
+ "metadata": {
175
+ "kernelspec": {
176
+ "display_name": "Python 3",
177
+ "language": "python",
178
+ "name": "python3"
179
+ },
180
+ "language_info": {
181
+ "codemirror_mode": {
182
+ "name": "ipython",
183
+ "version": 3
184
+ },
185
+ "file_extension": ".py",
186
+ "mimetype": "text/x-python",
187
+ "name": "python",
188
+ "nbconvert_exporter": "python",
189
+ "pygments_lexer": "ipython3",
190
+ "version": "3.10.12"
191
+ }
192
+ },
193
+ "nbformat": 4,
194
+ "nbformat_minor": 4
195
+ }
benchmark/NBspecific_14/README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset Information
2
+
3
+
4
+
5
+ ## Dataset: Titanic - Machine Learning from Disaster
6
+
7
+ **Source:**
8
+ - **Title:** Titanic - Machine Learning from Disaster
9
+ - **URL:** [https://www.kaggle.com/competitions/titanic/data](https://www.kaggle.com/competitions/titanic/data)
10
+ - **Attribution:** Shared on Kaggle or other platform.
11
+
12
+ **License:**
13
+ - **License Type:** This dataset originated from a Kaggle competition and is available for academic use.
14
+ - **Summary:** Attribution and usage rules as specified by the dataset's license.
15
+
16
+
17
+
18
+ **How to Attribute:**
19
+ > "Titanic - Machine Learning from Disaster". Available at https://www.kaggle.com/competitions/titanic/data. This dataset originated from a Kaggle competition and is available for academic use.
20
+
21
+
22
+
{data → benchmark}/NBspecific_14/data/test.csv RENAMED
File without changes
{data → benchmark}/NBspecific_14/data/train.csv RENAMED
File without changes
benchmark/NBspecific_15/NBspecific_15.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
benchmark/NBspecific_15/NBspecific_15_fixed.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
benchmark/NBspecific_15/NBspecific_15_reproduced.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
benchmark/NBspecific_15/README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset Information
2
+
3
+
4
+
5
+ ## Dataset: low_light_enhancement
6
+
7
+ **Source:**
8
+ - **Title:** low_light_enhancement
9
+ - **URL:** [https://www.kaggle.com/datasets/hamzadope/low-light-enhancement](https://www.kaggle.com/datasets/hamzadope/low-light-enhancement)
10
+ - **Attribution:** Shared on Kaggle or other platform.
11
+
12
+ **License:**
13
+ - **License Type:** Unknown
14
+ - **Summary:** Attribution and usage rules as specified by the dataset's license.
15
+
16
+
17
+ **Note:**
18
+ - This dataset was downsampled.
19
+
20
+
21
+
22
+
{data → benchmark}/NBspecific_15/data_small/src_images/img-0.jpg RENAMED
File without changes
{data → benchmark}/NBspecific_15/data_small/src_images/img-1.jpg RENAMED
File without changes
{data → benchmark}/NBspecific_15/data_small/src_images/img-10.jpg RENAMED
File without changes
{data → benchmark}/NBspecific_15/data_small/src_images/img-100.jpg RENAMED
File without changes
{data → benchmark}/NBspecific_15/data_small/src_images/img-1000.jpg RENAMED
File without changes
{data → benchmark}/NBspecific_15/data_small/src_images/img-1001.jpg RENAMED
File without changes
{data → benchmark}/NBspecific_15/data_small/src_images/img-1002.jpg RENAMED
File without changes
{data → benchmark}/NBspecific_15/data_small/src_images/img-1003.jpg RENAMED
File without changes
{data → benchmark}/NBspecific_15/data_small/src_images/img-1004.jpg RENAMED
File without changes
{data → benchmark}/NBspecific_15/data_small/src_images/img-1005.jpg RENAMED
File without changes