机器学习:手写数字数据集


手写数字数据集(下载地址:http://www.cs.nyu.edu/~roweis/data.html

  手写数字数据集包括1797个0-9的手写数字数据,每个数字由8*8大小的矩阵构成,矩阵中值的范围是0-16,代表颜色的深度。
  使用sklearn.datasets.load_digits即可加载相关数据集。

参数:
* return_X_y:若为True ,则以(data, target)形式返回数据;默认为False,表示以字典形式返回数据全部信息(包括data和target)。
* n_class:表示返回数据的类别数,如:n_class = 5, 则返回0到4的数据样本。

加载数据:

>>> from sklearn.datasets import load_digits
>>> digits = load_digits()
>>> print(digits.data.shape)
>>> print(digits.target.shape)
>>> print(digits.images.shape)

>>> import matplotlib.pyplot as plt
>>> plt.matshow(digits.images[0])
>>> plt.show()

输出:

(1797L, 64L)
(1797L,)
(1797L, 8L, 8L)

(未完待续)

 

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM