GithubHelp home page GithubHelp logo

notmishaal / spam-classification Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3.09 MB

Classify emails as spam or not spam, based on their content.

Jupyter Notebook 100.00%
classification decision-trees jupyter-notebook knn machine-learning

spam-classification's Introduction

Spam Classification

About

A project to classify emails as spam or not-spam based on their contents. Using different machine learning algorithms, applied on the UCI Machine Learning Repository's Spambase dataset.

Table of Contents

  1. About
  2. Dataset
  3. Data Preprocessing
  4. Modelling
  5. Model Evaluation
  6. Dependencies

Dataset

The dataset used for this project is the UCI Machine Learning Repository's Spambase dataset, available at https://archive.ics.uci.edu/ml/datasets/Spambase. It consists of various attributes related to emails, including word frequency, character frequency, and capital letter run length and also a binary spam attribute indicating if an email is considered spam or not.
More information can be found in the spambase.DOCUMENTATION file.

Data Preprocessing

The data preprocessing steps that were performed on the dataset include:

  • Duplicate Removal
  • Dealing with Null Values
  • Fixing Data Imbalances
  • Data Training & Testing Split
  • Data Standardization
  • Feature Selection

Modelling

The 2 machine learning models used for this project were K Nearest Neighbors (KNN) and Decision Trees.

Model Evaluation

KNN

precision recall f1-score support
0 0.93 0.93 0.93 604
1 0.94 0.94 0.94 662
accuracy 0.93 1266
macro avg 0.93 0.93 0.93 1266
weighted avg 0.93 0.93 0.93 1266

DT

precision recall f1-score support
0 0.88 0.95 0.92 604
1 0.95 0.88 0.92 662
accuracy 0.92 1266
macro avg 0.92 0.92 0.92 1266
weighted avg 0.92 0.92 0.92 1266

Dependencies

The following libraries were used in the project:

  • scikit-learn
  • pandas
  • seaborn
  • matplotlib
  • imblearn
  • collections

Results

While the Decision Tree model did outperform the KNN model in some metrics, such as recall of non-spam and precision of spam. Overall the KNN model proved to have the better overall performance when it came to the evaluation.

spam-classification's People

Contributors

notmishaal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.