0% found this document useful (0 votes)
12 views3 pages

Naive Bayes Spam Email Classification

This document outlines an experiment to classify email messages as Spam or Not Spam using the Naive Bayes classification algorithm. The project utilizes a Spam SMS dataset from Kaggle, employing Python and various libraries for data processing, model training, and evaluation, achieving high accuracy of approximately 98.5%. The system allows users to input messages for instant spam detection predictions, demonstrating the effectiveness of machine learning in automated spam classification.

Uploaded by

pritish9801.edu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Naive Bayes Spam Email Classification

This document outlines an experiment to classify email messages as Spam or Not Spam using the Naive Bayes classification algorithm. The project utilizes a Spam SMS dataset from Kaggle, employing Python and various libraries for data processing, model training, and evaluation, achieving high accuracy of approximately 98.5%. The system allows users to input messages for instant spam detection predictions, demonstrating the effectiveness of machine learning in automated spam classification.

Uploaded by

pritish9801.edu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Aim

The aim of this experiment is to classify email messages as Spam or Not Spam (Ham) using the
Naive Bayes classification algorithm with machine learning techniques.

2. Objective

To load and preprocess an email spam dataset.

To convert text messages into numerical features using Count Vectorizer.

To train a Multinomial Naive Bayes classifier for spam detection.

To evaluate the model performance using accuracy and classification report.

To develop a function that can classify any user-entered message as Spam or Ham.

3. Abstract Description

This project implements a Spam Email Classification System using supervised machine learning.

The model is trained on the Spam SMS dataset to automatically detect whether a given message
is spam or not.

Dataset Details:

Dataset Name: Spam SMS Dataset

Source: Kaggle

File Used: [Link]

Encoding: latin-1

Total Records: 5,572 messages

Attributes Used:

v1 Label (spam / ham)

v2 Message text

The labels are converted into numeric form where spam = 1 and ham = 0.

4. Tools & Technologies


Programming Language

Python

Libraries Used

Pandas – Data loading and manipulation

NumPy – Numerical operations

Scikit-learn –

train_test_split for data splitting

CountVectorizer for feature extraction

MultinomialNB for classification

accuracy_score and classification_report for evaluation

Methodology

Load dataset and clean required columns

Encode labels (spam/ham 1/0)

Split data into training and testing sets

Convert text into word frequency vectors

Train Naive Bayes classifier

Evaluate model performance

Predict spam or ham for new user input

5. Optimization

Stop-word removal is applied using CountVectorizer(stop_words='english') to reduce noise.

Multinomial Naive Bayes is chosen because it is efficient for text classification problems.

The dataset is split using an 80–20 train-test ratio for better generalization.
Feature extraction using word frequency improves classification accuracy.

The model achieves high accuracy (~98.5%), indicating good optimization.

6. Conclusion

The Spam Email Classification system successfully identifies spam and non-spam messages
with high accuracy and efficiency.

Using Naive Bayes and word frequency features, the model performs well on real-world email
messages.

The implemented function allows users to input any message and instantly receive a prediction.

This approach proves that machine learning techniques are effective for automated spam
detection systems.

You might also like