This project focuses on building an intelligent system to classify messages as either Spam or Ham using Natural Language Processing (NLP) and Machine Learning.
- Detect spam messages automatically.
- Apply text preprocessing techniques to clean and prepare the data.
- Train a machine learning model to classify new messages.
- Deploy a simple prediction app using Streamlit.
- Source: SMS Spam Collection Dataset
- Contains labeled SMS messages
- Classes:
- Ham (Not Spam)
- Spam
- Load the dataset
- Clean the data
- remove unnecessary columns
- rename columns
- handle missing values and duplicates
- Explore the data
- check class distribution
- analyze message length and word patterns
- Preprocess text
- lowercase text
- remove punctuation and special characters
- tokenize words
- remove stopwords
- apply stemming
- Convert text into features
- use TF-IDF vectorization
- Train the model
- use Multinomial Naive Bayes
- Evaluate performance
- accuracy
- precision
- recall
- F1-score
- confusion matrix
- Build a prediction app
- create a Streamlit interface for real-time testing
- Python
- Pandas
- NumPy
- Scikit-learn
- NLTK
- Matplotlib
- Seaborn
- Streamlit
- Jupyter Notebook
- Email_Spam_Detection.ipynb — main notebook for analysis and modeling
- app/app.py — Streamlit web app
- app/requirements.txt — Python dependencies
- dataset/spam.csv — dataset file
- outputs/ — saved model metrics and reports
cd DataScience-Task4-EmailSpamDetection
pip install -r app/requirements.txt
streamlit run app/app.py- The model should classify incoming messages as spam or ham.
- The web app should provide a quick and interactive prediction experience.