File size: 2,414 Bytes
94ce757
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
license: wtfpl
datasets:
- arkodeep/spam-data
language:
- en
tags:
- spam
- spam classification
- text
- spam detection
- text classification
---

# Spam Detection System

## Lite Model

### Introduction
The Lite model is a streamlined approach with optimized parameters and enhanced feature extraction designed for quick and efficient spam detection.

### Features
- **Text Preprocessing**: Lemmatization, removal of stop words and punctuation.
- **Feature Extraction**: Text length, word count, unique word count, uppercase count, special character count.
- **Model Creation**: Ensemble model using SVC, MultinomialNB, and ExtraTreesClassifier.
- **Visualization**: Generates graphs for dataset insights, word clouds, and performance metrics.
- **Metrics Saving**: Accuracy, precision, and F1 score.

### How to Run
1. **Train the Model**:
    ```bash
    python training/train_model_lite.py
    ```
2. **Use the Model**:
    ```python
    import joblib
    model = joblib.load('models/model.pkl')
    vectorizer = joblib.load('models/vectorizer.pkl')
    ```

## Legacy Model

### Introduction
The Legacy model retains the original model logic without optimization but updates the structure and adds visualizations for spam detection.

### Features
- **Text Preprocessing**: Porter Stemming, removal of stop words and punctuation.
- **Model Creation**: Ensemble model using SVC, MultinomialNB, and ExtraTreesClassifier with original parameters.
- **Visualization**: Generates graphs for dataset insights, word clouds, and performance metrics.
- **Metrics Saving**: Accuracy and precision.

### How to Run
1. **Train the Model**:
    ```bash
    python training/train_model_legacy.py
    ```
2. **Use the Model**:
    ```python
    import joblib
    model = joblib.load('models/model.pkl')
    vectorizer = joblib.load('models/vectorizer.pkl')
    ```

### Additional Information
- **Dependencies**: Python 3.6 or higher, pip, and required packages listed in `requirements.txt`.
- **Dataset**: The dataset used for training is `spam.csv`.
- **Contact and Support**: For questions or support, please contact the project maintainers.

For more details, you can refer to the [README.md](https://github.com/arkodeepsen/spam-filter-mbo/blob/4894a939099e5523f22bf3c2e5b3d763c92a73c6/README.md) and [models.md](https://github.com/arkodeepsen/spam-filter-mbo/blob/4894a939099e5523f22bf3c2e5b3d763c92a73c6/models.md).