Digit Image Classification Model

A Voting Classifier (SVM + Random Forest + KNN) predicting handwritten digits (0–9) from 8×8 pixel images.

Dataset

Trained on the sklearn digits dataset — 1797 samples, 64 features (8×8 grayscale pixel values, range 0–16).

Preprocessing

  • Features standardized with StandardScaler, fit on the training split only.
  • Dimensionality reduced with PCA (n_components=0.95 — 95% variance retained), reducing 64 features to ~40 components.

Model

Hard voting ensemble of three classifiers, each tuned via GridSearchCV:

Classifier Best Params
SVM C, kernel searched over [0.1, 1, 10] × ["linear", "rbf"]
Random Forest n_estimators searched over [50, 100, 200]
KNN n_neighbors searched over [3, 5, 7]

Files

  • digit_classifier_artifact.joblib: dict with {"model", "scaler", "pca"}.
  • digit-image-classification.ipynb: full notebook (preprocessing, GridSearchCV, VotingClassifier, evaluation).

Usage

import joblib
import numpy as np
from huggingface_hub import hf_hub_download

path = hf_hub_download(repo_id="KubraParmak/digit-classifier-model", filename="digit_classifier_artifact.joblib")
artifact = joblib.load(path)

scaler = artifact["scaler"]
pca    = artifact["pca"]
model  = artifact["model"]

# X: numpy array of shape (n_samples, 64), pixel values in range 0–16
X_scaled = scaler.transform(X)
X_pca    = pca.transform(X_scaled)
predictions = model.predict(X_pca)

Performance

Test accuracy: 0.97 (VotingClassifier, hard voting, 5-fold CV).

Live Demo

See KubraParmak/digit-image-classification for an interactive Gradio demo.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using KubraParmak/digit-classifier-model 1