This project focuses on digit recognition using Singular Value Decomposition (SVD) as a dimensionality reduction technique. The dataset used for training and testing contains handwritten digits in a matrix format.
Make sure you have the following dependencies installed:
- Python (>=3.6)
- Required Python packages:
matplotlib
,pandas
,numpy
,scipy
,scikit-learn
The dataset consists of two main parts:
- Training Data:
- Features (
xtrain
): Handwritten digit images in matrix form. - Labels (
ytrain
): Corresponding digit labels for training.
- Features (
- Testing Data:
- Features (
xtest
): Handwritten digit images for testing. - Labels (
ytest
): True labels for testing data.
- Features (
- Displaying Digits: The
show_digit
function takes the index of a column and displays the corresponding digit from the dataset. - Creating Matrices: Matrices for each digit (0-9) are extracted from the training data.
- SVD Analysis: Singular Value Decomposition is applied to each digit's matrix.
- Optimal Number of Basis Vectors: The accuracy of the digit recognition model is evaluated for different numbers of basis vectors.
- Accuracy Scores: The accuracy scores for various numbers of basis vectors are displayed.
- Confusion Matrix: A confusion matrix is generated for the model with the optimal number of basis vectors.
- Common Misclassifications: Some commonly misclassified digits are displayed, providing insights into the model's performance.
- Impact of Changes: The impact of changing the number of basis vectors for specific digits is explored.