Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

SMS Spam Classifier

This project implements a machine learning-based spam detection system that classifies SMS messages as either "spam" or "ham" (legitimate) using the Multinomial Naïve Bayes algorithm with TF-IDF feature extraction.

Features

  • Text Preprocessing: Comprehensive text cleaning including lowercasing, punctuation removal, tokenization, stopword removal, and lemmatization
  • TF-IDF Vectorization: Converts text into numerical features using Term Frequency-Inverse Document Frequency with bigram support
  • Multinomial Naïve Bayes: Probabilistic classifier optimized for text classification tasks
  • Performance Metrics: Detailed evaluation including accuracy, precision, recall, F1-score, and confusion matrix
  • Feature Importance Analysis: Identifies top spam and ham indicator words
  • Custom Prediction Function: Easy-to-use interface for classifying new messages

Dataset

SMS Spam Collection Dataset
(https://www.kaggle.com/datasets/uciml/sms-spam-collection-dataset)

  • Text messages labeled as spam or ham
  • Imbalanced dataset with more legitimate messages than spam
  • Preprocessed and cleaned for optimal model performance

Technologies Used

  • pandas - Data manipulation and analysis
  • numpy - Numerical computing
  • matplotlib & seaborn - Data visualization
  • nltk - Natural language processing
  • scikit-learn - Machine learning algorithms and utilities
    • TfidfVectorizer
    • MultinomialNB
    • train_test_split
    • Performance metrics

Project Structure

.
├── ML_Project_Spam_SMS_Classifier.ipynb  # Main notebook
├── SMSSpamCollection                      # Dataset file
└── README.md                              # Project documentation

Usage

  1. Ensure the SMSSpamCollection dataset is in the same directory
  2. Open ML_Project_Spam_SMS_Classifier.ipynb in Jupyter Notebook
  3. Run all cells sequentially

About

SMS Spam Detection system using Multinomial Naïve Bayes algorithm with TF-IDF feature extraction.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages