sklearn中digits手写字体数据集
生活随笔
收集整理的這篇文章主要介紹了
sklearn中digits手写字体数据集
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1. 導(dǎo)入
from sklearn import datasets digits = datasets.load_digits()2. 屬性查看
- digits: bunch類型
3. 具體數(shù)據(jù)
- 1797個(gè)樣本,每個(gè)樣本包括8*8像素的圖像和一個(gè)[0, 9]整數(shù)的標(biāo)簽
3.1 images
- ndarray類型,保存8*8的圖像,里面的元素是float64類型,共有1797張圖片
- 用于顯示圖片
- import matplotlib.pyplot as plt plt.imshow(digits.images[0])<matplotlib.image.AxesImage at 0x1676ca13ba8> plt.show()
- ?
?
# 獲取第一張圖片 print(digits.images[0]) [[ 0. 0. 5. 13. 9. 1. 0. 0.][ 0. 0. 13. 15. 10. 15. 5. 0.][ 0. 3. 15. 2. 0. 11. 8. 0.][ 0. 4. 12. 0. 0. 8. 8. 0.][ 0. 5. 8. 0. 0. 9. 8. 0.][ 0. 4. 11. 0. 1. 12. 7. 0.][ 0. 2. 14. 5. 10. 12. 0. 0.][ 0. 0. 6. 13. 10. 0. 0. 0.]]-
或者
- from skimage import io im=plt.imshow(digits.images[0]) print(type(im))<class 'matplotlib.image.AxesImage'> io.show()
?
3.2 data
- ndarray類型,將images按行展開成一行,共有1797行
- 輸入數(shù)據(jù)
- print(digits.data[0]) [ 0. 0. 5. 13. 9. 1. 0. 0. 0. 0. 13. 15. 10. 15. 5.0. 0. 3. 15. 2. 0. 11. 8. 0. 0. 4. 12. 0. 0. 8.8. 0. 0. 5. 8. 0. 0. 9. 8. 0. 0. 4. 11. 0. 1.12. 7. 0. 0. 2. 14. 5. 10. 12. 0. 0. 0. 0. 6. 13.10. 0. 0. 0.]
3.3 target
- ndarray類型,指明每張圖片的標(biāo)簽,也就是每張圖片代表的數(shù)字
- 輸出數(shù)據(jù),標(biāo)簽
- print(digits.target[0])0
3.4 target_names
- ndarray類型,數(shù)據(jù)集中所有標(biāo)簽值
- print(digits.target_names)
[0 1 2 3 4 5 6 7 8 9]
3.5 DESCR
- 數(shù)據(jù)集的描述,作者,數(shù)據(jù)來(lái)源等
- print(digits.DESCR)
.. _digits_dataset:Optical recognition of handwritten digits dataset
--------------------------------------------------**Data Set Characteristics:**:Number of Instances: 5620:Number of Attributes: 64:Attribute Information: 8x8 image of integer pixels in the range 0..16.:Missing Attribute Values: None:Creator: E. Alpaydin (alpaydin '@' boun.edu.tr):Date: July; 1998This is a copy of the test set of the UCI ML hand-written digits datasets
http://archive.ics.uci.edu/ml/datasets/Optical+Recognition+of+Handwritten+DigitsThe data set contains images of hand-written digits: 10 classes where
each class refers to a digit.Preprocessing programs made available by NIST were used to extract
normalized bitmaps of handwritten digits from a preprinted form. From a
total of 43 people, 30 contributed to the training set and different 13
to the test set. 32x32 bitmaps are divided into nonoverlapping blocks of
4x4 and the number of on pixels are counted in each block. This generates
an input matrix of 8x8 where each element is an integer in the range
0..16. This reduces dimensionality and gives invariance to small
distortions.For info on NIST preprocessing routines, see M. D. Garris, J. L. Blue, G.
T. Candela, D. L. Dimmick, J. Geist, P. J. Grother, S. A. Janet, and C.
L. Wilson, NIST Form-Based Handprint Recognition System, NISTIR 5469,
1994... topic:: References- C. Kaynak (1995) Methods of Combining Multiple Classifiers and TheirApplications to Handwritten Digit Recognition, MSc Thesis, Institute ofGraduate Studies in Science and Engineering, Bogazici University.- E. Alpaydin, C. Kaynak (1998) Cascading Classifiers, Kybernetika.- Ken Tang and Ponnuthurai N. Suganthan and Xi Yao and A. Kai Qin.Linear dimensionalityreduction using relevance weighted LDA. School ofElectrical and Electronic Engineering Nanyang Technological University.2005.- Claudio Gentile. A New Approximate Maximal Margin ClassificationAlgorithm. NIPS. 2000.
? ? ? ? ? ? ? ? ? ??
? ??
? ? ?
? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ??
?
?
?
?
?
?
?
?
總結(jié)
以上是生活随笔為你收集整理的sklearn中digits手写字体数据集的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 中service层的作用_浅析Java中
- 下一篇: python的tool模块_barkto