jfo25 commited on
Commit
e0670f1
·
1 Parent(s): d564054

vectorizer

Browse files
Files changed (2) hide show
  1. sms_vectorizer.pkl +3 -0
  2. spam-detector-Mathis-AI.ipynb +43 -18
sms_vectorizer.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e78e5596ceaf5a0c1f4100235ce1d528801a34a57732e86c4857a2e5ead0f9d2
3
+ size 106218
spam-detector-Mathis-AI.ipynb CHANGED
@@ -18,7 +18,7 @@
18
  },
19
  {
20
  "cell_type": "code",
21
- "execution_count": 12,
22
  "id": "8a313f24",
23
  "metadata": {},
24
  "outputs": [],
@@ -36,7 +36,7 @@
36
  },
37
  {
38
  "cell_type": "code",
39
- "execution_count": 2,
40
  "id": "e530b713",
41
  "metadata": {},
42
  "outputs": [
@@ -104,7 +104,7 @@
104
  "4 ham Nah I don't think he goes to usf, he lives aro..."
105
  ]
106
  },
107
- "execution_count": 2,
108
  "metadata": {},
109
  "output_type": "execute_result"
110
  }
@@ -127,7 +127,7 @@
127
  },
128
  {
129
  "cell_type": "code",
130
- "execution_count": 3,
131
  "id": "fb533887",
132
  "metadata": {},
133
  "outputs": [
@@ -195,7 +195,7 @@
195
  "4 0 Nah I don't think he goes to usf, he lives aro..."
196
  ]
197
  },
198
- "execution_count": 3,
199
  "metadata": {},
200
  "output_type": "execute_result"
201
  }
@@ -210,7 +210,7 @@
210
  },
211
  {
212
  "cell_type": "code",
213
- "execution_count": 4,
214
  "id": "c4ea8a09",
215
  "metadata": {},
216
  "outputs": [
@@ -220,7 +220,7 @@
220
  "((5572, 8713), (5572,))"
221
  ]
222
  },
223
- "execution_count": 4,
224
  "metadata": {},
225
  "output_type": "execute_result"
226
  }
@@ -255,7 +255,7 @@
255
  },
256
  {
257
  "cell_type": "code",
258
- "execution_count": 5,
259
  "id": "aea723b8",
260
  "metadata": {},
261
  "outputs": [
@@ -293,7 +293,7 @@
293
  },
294
  {
295
  "cell_type": "code",
296
- "execution_count": 6,
297
  "id": "2d01ce1c",
298
  "metadata": {},
299
  "outputs": [
@@ -320,7 +320,7 @@
320
  },
321
  {
322
  "cell_type": "code",
323
- "execution_count": 7,
324
  "id": "7e014dbc",
325
  "metadata": {},
326
  "outputs": [
@@ -340,7 +340,7 @@
340
  },
341
  {
342
  "cell_type": "code",
343
- "execution_count": 8,
344
  "id": "c61d8311",
345
  "metadata": {},
346
  "outputs": [
@@ -358,7 +358,7 @@
358
  },
359
  {
360
  "cell_type": "code",
361
- "execution_count": 9,
362
  "id": "ef960679",
363
  "metadata": {},
364
  "outputs": [
@@ -376,7 +376,7 @@
376
  },
377
  {
378
  "cell_type": "code",
379
- "execution_count": 10,
380
  "id": "58f88820",
381
  "metadata": {},
382
  "outputs": [
@@ -394,7 +394,7 @@
394
  },
395
  {
396
  "cell_type": "code",
397
- "execution_count": 11,
398
  "id": "8f4f505b",
399
  "metadata": {},
400
  "outputs": [
@@ -404,7 +404,7 @@
404
  "<Axes: xlabel='label', ylabel='count'>"
405
  ]
406
  },
407
- "execution_count": 11,
408
  "metadata": {},
409
  "output_type": "execute_result"
410
  },
@@ -433,7 +433,19 @@
433
  },
434
  {
435
  "cell_type": "code",
436
- "execution_count": 13,
 
 
 
 
 
 
 
 
 
 
 
 
437
  "id": "dba57e87",
438
  "metadata": {},
439
  "outputs": [],
@@ -458,9 +470,22 @@
458
  "execution_count": null,
459
  "id": "6ebccf7a",
460
  "metadata": {},
461
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  "source": [
463
- "with open('dht11_model.pkl','rb') as file: \n",
464
  " model=pickle.load(file)"
465
  ]
466
  }
 
18
  },
19
  {
20
  "cell_type": "code",
21
+ "execution_count": 14,
22
  "id": "8a313f24",
23
  "metadata": {},
24
  "outputs": [],
 
36
  },
37
  {
38
  "cell_type": "code",
39
+ "execution_count": 15,
40
  "id": "e530b713",
41
  "metadata": {},
42
  "outputs": [
 
104
  "4 ham Nah I don't think he goes to usf, he lives aro..."
105
  ]
106
  },
107
+ "execution_count": 15,
108
  "metadata": {},
109
  "output_type": "execute_result"
110
  }
 
127
  },
128
  {
129
  "cell_type": "code",
130
+ "execution_count": 16,
131
  "id": "fb533887",
132
  "metadata": {},
133
  "outputs": [
 
195
  "4 0 Nah I don't think he goes to usf, he lives aro..."
196
  ]
197
  },
198
+ "execution_count": 16,
199
  "metadata": {},
200
  "output_type": "execute_result"
201
  }
 
210
  },
211
  {
212
  "cell_type": "code",
213
+ "execution_count": 17,
214
  "id": "c4ea8a09",
215
  "metadata": {},
216
  "outputs": [
 
220
  "((5572, 8713), (5572,))"
221
  ]
222
  },
223
+ "execution_count": 17,
224
  "metadata": {},
225
  "output_type": "execute_result"
226
  }
 
255
  },
256
  {
257
  "cell_type": "code",
258
+ "execution_count": 18,
259
  "id": "aea723b8",
260
  "metadata": {},
261
  "outputs": [
 
293
  },
294
  {
295
  "cell_type": "code",
296
+ "execution_count": 19,
297
  "id": "2d01ce1c",
298
  "metadata": {},
299
  "outputs": [
 
320
  },
321
  {
322
  "cell_type": "code",
323
+ "execution_count": 20,
324
  "id": "7e014dbc",
325
  "metadata": {},
326
  "outputs": [
 
340
  },
341
  {
342
  "cell_type": "code",
343
+ "execution_count": 21,
344
  "id": "c61d8311",
345
  "metadata": {},
346
  "outputs": [
 
358
  },
359
  {
360
  "cell_type": "code",
361
+ "execution_count": 22,
362
  "id": "ef960679",
363
  "metadata": {},
364
  "outputs": [
 
376
  },
377
  {
378
  "cell_type": "code",
379
+ "execution_count": 23,
380
  "id": "58f88820",
381
  "metadata": {},
382
  "outputs": [
 
394
  },
395
  {
396
  "cell_type": "code",
397
+ "execution_count": 24,
398
  "id": "8f4f505b",
399
  "metadata": {},
400
  "outputs": [
 
404
  "<Axes: xlabel='label', ylabel='count'>"
405
  ]
406
  },
407
+ "execution_count": 24,
408
  "metadata": {},
409
  "output_type": "execute_result"
410
  },
 
433
  },
434
  {
435
  "cell_type": "code",
436
+ "execution_count": 27,
437
+ "id": "faf22bf2",
438
+ "metadata": {},
439
+ "outputs": [],
440
+ "source": [
441
+ "# Sauvegarder le vectorizer\n",
442
+ "with open('sms_vectorizer.pkl', 'wb') as file:\n",
443
+ " pickle.dump(vectorizer, file)"
444
+ ]
445
+ },
446
+ {
447
+ "cell_type": "code",
448
+ "execution_count": 25,
449
  "id": "dba57e87",
450
  "metadata": {},
451
  "outputs": [],
 
470
  "execution_count": null,
471
  "id": "6ebccf7a",
472
  "metadata": {},
473
+ "outputs": [
474
+ {
475
+ "ename": "FileNotFoundError",
476
+ "evalue": "[Errno 2] No such file or directory: 'dht11_model.pkl'",
477
+ "output_type": "error",
478
+ "traceback": [
479
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
480
+ "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
481
+ "Cell \u001b[0;32mIn[26], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mopen\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdht11_model.pkl\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mrb\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m file: \n\u001b[1;32m 2\u001b[0m model\u001b[38;5;241m=\u001b[39mpickle\u001b[38;5;241m.\u001b[39mload(file)\n",
482
+ "File \u001b[0;32m~/anaconda3/lib/python3.12/site-packages/IPython/core/interactiveshell.py:324\u001b[0m, in \u001b[0;36m_modified_open\u001b[0;34m(file, *args, **kwargs)\u001b[0m\n\u001b[1;32m 317\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m file \u001b[38;5;129;01min\u001b[39;00m {\u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m1\u001b[39m, \u001b[38;5;241m2\u001b[39m}:\n\u001b[1;32m 318\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 319\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIPython won\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt let you open fd=\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mfile\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m by default \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 320\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mas it is likely to crash IPython. If you know what you are doing, \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 321\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124myou can use builtins\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m open.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 322\u001b[0m )\n\u001b[0;32m--> 324\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m io_open(file, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n",
483
+ "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'dht11_model.pkl'"
484
+ ]
485
+ }
486
+ ],
487
  "source": [
488
+ "with open('sms_spam_detector_model.pkl','rb') as file: \n",
489
  " model=pickle.load(file)"
490
  ]
491
  }