Skip to content

This project implements a spam detection model using a two-layer deep neural network. The model classifies emails as either spam or not spam using a dataset of email messages.

License

Notifications You must be signed in to change notification settings

muhammadsaadx/Spam-Detection-with-a-Custom-Two-Layer-Neural-Network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Spam Detection using Neural Networks

This project implements a spam detection model using a two-layer deep neural network. The model classifies emails as either spam or not spam using a dataset of email messages.

Dataset

The dataset used in this project is spam_or_not_spam.csv, which contains email texts and their corresponding labels:

  • 0: Not spam
  • 1: Spam

Installation

To run this project, install the required dependencies using:

pip install numpy pandas scikit-learn matplotlib

Data Preprocessing

  1. Load the dataset and handle missing values.
  2. Balance the dataset to avoid class imbalance issues.
  3. Convert email texts into numerical representations using CountVectorizer.
  4. Apply word embeddings and flatten the data for neural network input.
  5. Split the data into training and testing sets.

Model Training

  • The model is trained using a two-layer neural network.
  • It takes in the preprocessed feature vectors and outputs binary classifications (spam or not spam).
  • The training set is used to optimize model parameters.

Evaluation

The model is evaluated using:

  • Accuracy
  • Precision
  • Recall
  • F1-score
  • Confusion Matrix

Usage

Run the Jupyter Notebook to execute the steps:

jupyter notebook spam_detection_nn.ipynb

Results

The model's performance is analyzed using metrics and visualizations to assess its effectiveness in detecting spam emails.

About

This project implements a spam detection model using a two-layer deep neural network. The model classifies emails as either spam or not spam using a dataset of email messages.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published