Renu-code123/Detecting-Spam-Emails-Using-Tensorflow-in-Python

AI-powered spam email classifier built with TensorFlow that detects and filters unwanted messages using NLP.

โ˜… 1Forks 0PythonGitHub โ†—Compare
deep-learningmachine-learningnlppythonspam--detectiontensorflow

README

๐Ÿ“ง Spam Email Detection using TensorFlow

Python TensorFlow Status


๐Ÿš€ Overview

In today's digital world, spam emails are everywhere โ€” from fake offers to phishing attempts.
This project builds a Spam Email Detection System using TensorFlow and Python to automatically classify emails as:

  • ๐Ÿ“ฉ Ham (Not Spam)
  • ๐Ÿšซ Spam

The model learns patterns from email text data and predicts whether a message is spam with high efficiency.


๐ŸŽฏ Key Features

  • โœจ Intelligent classification of emails
  • ๐Ÿงน Text preprocessing & cleaning pipeline
  • ๐Ÿง  Deep learning model powered by TensorFlow
  • โšก Fast and efficient predictions
  • ๐Ÿ“Š Easy-to-understand workflow
  • ๐Ÿ“ Clean and modular code structure

๐Ÿ› ๏ธ Tech Stack

  • ๐Ÿ Python
  • ๐Ÿ”ถ TensorFlow
  • ๐Ÿ”ข NumPy
  • ๐Ÿ“Š Pandas
  • ๐Ÿค– Scikit-learn
  • ๐Ÿงพ Natural Language Processing (NLP)

๐Ÿง  How It Works

  1. Data Collection

    • Email dataset containing spam and ham messages
  2. Text Preprocessing

    • Lowercasing
    • Removing punctuation & stopwords
    • Tokenization
  3. Feature Extraction

    • Converting text into numerical format (e.g., TF-IDF / Tokenizer)
  4. Model Building

    • Neural Network using TensorFlow
  5. Training

    • Model learns patterns in spam vs ham emails
  6. Prediction

    • Classifies new emails as Spam or Ham

๐Ÿ“‚ Project Structure

Spam-Email-Detection/
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ spam.csv              # Dataset
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ”œโ”€โ”€ EDA.ipynb            # Data analysis & visualization
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ preprocessing.py     # Text cleaning functions
โ”‚   โ”œโ”€โ”€ model.py             # TensorFlow model
โ”‚   โ”œโ”€โ”€ train.py             # Training script
โ”‚   โ”œโ”€โ”€ predict.py           # Prediction script
โ”‚
โ”œโ”€โ”€ saved_model/
โ”‚   โ”œโ”€โ”€ model.h5             # Trained model
โ”‚
โ”œโ”€โ”€ requirements.txt         # Dependencies
โ”œโ”€โ”€ README.md                # Project documentation
โ””โ”€โ”€ main.py                  # Entry point

Contributors

Renu-code123

Issues