Git Product home page Git Product logo

naive-bayes-spam-classifier's Introduction

Naive Bayes Spam Classifier

This repository contains code for training a Naive Bayes spam classifier using scikit-learn.

Code Overview

Instructions

  1. Clone this repository to your local machine.
  2. Install the required libraries by running: pip install pandas numpy scikit-learn.
  3. Run the Jupyter Notebook spam_classifier.ipynb to see the step-by-step process of building the spam classifier.

Usage

  1. Open the Jupyter Notebook spam_classifier.ipynb.
  2. Follow along with the code to preprocess the data, build the model, and evaluate its performance.
  3. Modify the emails list to test the model with new emails.
  4. The code uses the Bag of Words vectorizer to convert text data into numerical features.
  5. The classification algorithm used in this project is Naive Bayes.

Naive Bayes Classifier

The Naive Bayes algorithm is a probabilistic classification technique based on Bayes' theorem. It's particularly effective for text classification tasks, such as spam detection and sentiment analysis. Despite its simple assumption of feature independence, Naive Bayes often works well for many real-world text datasets.

Results

The trained Naive Bayes model achieved an accuracy of approximately 99% on the test data.

Bag of Words Vectorizer

The Bag of Words vectorizer is used to convert text data into a numerical representation that can be used by machine learning algorithms. It creates a sparse matrix where each row represents a document (or email in this case) and each column represents a unique word in the dataset. The value in each cell represents the frequency of that word in the corresponding document.

Contact

For any questions or inquiries, feel free to contact [[email protected]] or (https://github.com/saatvik25).

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.