Digits#
Small greyscale images of handwritten digits, 8 by 8 pixels each, prepared from the NIST handwritten digit forms. Only the 1797 samples of the test part of the original UCI release are included. It is a small, fast dataset for trying out multiclass classifiers.
Overview#
Loader |
|
Task |
Classification |
Samples |
1797 |
Features |
64 |
Targets |
10 classes: |
Missing values |
None |
License |
CC BY 4.0 |
Features#
64 features named pixel_<row>_<column>. Every value is the count of active pixels in a
4 by 4 block of the original image, an integer from 0 to 16, stored as float64.
Target#
y is the digit shown in the image, an integer from 0 to 9. The ten classes have between
174 and 183 samples.
Source and citation#
Source: UCI Machine Learning Repository
Obtained from: scikit-learn (sklearn.datasets.load_digits), which redistributes a copy of the test set of the UCI dataset. The scikit-learn version is recorded in the file.
Creators: E. Alpaydin, C. Kaynak
Please cite the dataset as:
Alpaydin, E. & Kaynak, C. (1998). Optical Recognition of Handwritten Digits [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C50P49
See also:
Kaynak (1995) Methods of Combining Multiple Classifiers and Their Applications to Handwritten Digit Recognition, MSc Thesis, Institute of Graduate Studies in Science and Engineering, Bogazici University.
Alpaydin, C. Kaynak (1998) Cascading Classifiers, Kybernetika.
License#
CC BY 4.0, as stated by the source. The license was checked at the source on 2026-10-17. See License and citation.
Changes made#
Only the test set of the UCI dataset is included: 1797 of its 5620 samples, as distributed by scikit-learn. The training set (3823 samples) is not included.
Converted to the NumPy NPZ format. Pixels are stored as float64 and the digit as int64 labels.
Feature and class names follow scikit-learn.
Example#
>>> import numpy as np
>>> from pyml_datasets import load_digits
>>> data = load_digits()
>>> data.X.shape
(1797, 64)
>>> int(np.bincount(data.y).sum())
1797