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.
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
NaiveBayes_MNIST_Generator/ ├── images/ # Generated digit images (0–9) ├── model/ # Saved Bernoulli Naive Bayes model ├── NaiveBayes_MNIST_Generator.ipynb ├── requirements.txt └── README.md
- 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
- Clone this repo or download the folder.
- Install dependencies:
pip install -r requirements.txt - Open
NaiveBayes_MNIST_Generator.ipynb - Run all cells and check the
images/folder for generated digits.
This was completed as part of the Infosys Springboard course - Generative Models for Developers.
- Swati Upadhyay
- Aspiring AI Engineer | ML Intern @ Trecent Systems