This repository contains a Jupyter Notebook (DigitClassifier.ipynb
) that demonstrates the use of the Naive Bayes classifier for recognizing handwritten digits. It uses the UCI Optical Recognition of Handwritten Digits dataset, which consists of 8x8 images of handwritten digits.
- Problem
The Jupyter Notebook (DigitClassifier.ipynb
) in this repository demonstrates the following:
- Importing necessary Python libraries, including NumPy, Pandas, Matplotlib, and scikit-learn.
- Importing the Multinomial Naive Bayes classifier from scikit-learn.
- Loading the UCI Optical Recognition of Handwritten Digits dataset.
- Splitting the dataset into training and testing sets with a 50% split size.
- Training a Naive Bayes model on the training data.
- Making predictions on the test data and calculating the accuracy score.
- Visualizing the results by showing the predicted labels for random 20 images.
- Building a probability table for all single-digit numbers.
To run the Jupyter Notebook on your local machine, follow these steps:
- Clone this repository to your local machine:
git clone https://github.com/Shubham722-227/Digit_Classifier.git
- Navigate to the project directory:
cd Digit_Classifier
- Install Jupyter Notebook (if you haven't already):
pip install jupyter
- Start Jupyter Notebook:
jupyter notebook
-
Open the Jupyter Notebook (DigitClassifier.ipynb) in your browser.
-
Run the notebook cell by cell to execute the code.
The Jupyter Notebook can be used as a starting point for handwritten digit recognition tasks using Naive Bayes classifiers. You can modify the dataset, use different classifiers, or further customize the code to fit your specific requirements
- Accuracy
The Jupyter Notebook provides the following results:
- Naive Bayes score: The accuracy score of the Naive Bayes model on the test data.
- Counts of each number in the random split.
- Predictions on 20 random images.
- Probability table for all single-digit numbers. You can analyze these results to understand the performance of the model.