Skip to content

A machine learning project that repurposes Bernoulli Naive Bayes as a generative model to synthesize handwritten digits from the MNIST dataset. Implements pixel-wise probability learning, sampling, and image generation with smoothing techniques.

Notifications You must be signed in to change notification settings

SwatiUpadhyay/naivebayes-digit-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Naive Bayes MNIST Digit Generator

This project demonstrates how a Bernoulli Naive Bayes classifier can be repurposed as a generative model to create synthetic handwritten digits from the MNIST dataset.

πŸ“Œ Overview

While Naive Bayes is typically used for classification, this project uses it in a generative way:

  • Learns the pixel-wise probability of each digit
  • Uses sampling to generate new digits
  • Produces smoothed, readable digit images

πŸ“‚ Project Structure

NaiveBayes_MNIST_Generator/ β”œβ”€β”€ images/ # Generated digit images (0–9) β”œβ”€β”€ model/ # Saved Bernoulli Naive Bayes model β”œβ”€β”€ NaiveBayes_MNIST_Generator.ipynb β”œβ”€β”€ requirements.txt └── README.md

πŸ’‘ Key Features

  • Uses the MNIST dataset
  • Trains a Bernoulli Naive Bayes model
  • Generates digits using probabilistic sampling
  • Outputs both raw and smoothed versions
  • Saves model and results

βœ… How to Run

  1. Clone this repo or download the folder.
  2. Install dependencies:
    pip install -r requirements.txt
  3. Open NaiveBayes_MNIST_Generator.ipynb
  4. Run all cells and check the images/ folder for generated digits.

🧠 Inspiration

This was completed as part of the Infosys Springboard course - Generative Models for Developers.


πŸ‘©β€πŸ’» Author

  • Swati Upadhyay
  • Aspiring AI Engineer | ML Intern @ Trecent Systems

About

A machine learning project that repurposes Bernoulli Naive Bayes as a generative model to synthesize handwritten digits from the MNIST dataset. Implements pixel-wise probability learning, sampling, and image generation with smoothing techniques.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published