《Hands on Sklearn and TF》(1)

2018-05-09  本文已影响0人  ironmanblr

第三章中的MNIST数据集下载问题:


from sklearn.datasets import fetch_mldata

mnist = fetch_mldata('MNIST original')

这里程序会默认从sklearn 中下载MNIST original数据,这样程序运行可能会比较慢。这里是fetch_mldata()的说明:
http://scikit-learn.org/stable/datasets/mldata.html
第一行写到:

mldata.org is a public repository for machine learning data, supported by the PASCAL network .
The sklearn.datasets package is able to directly download data sets from the repository using the functionsklearn.datasets.fetch_mldata.

因此,可以事先去mldata.org(by the way,这个数据库有丰富的数据集可以拿来用) 把MNIST数据集下好,放在当前程序的‘\MNIST_data\mldata’文件夹下。
相应的,源程序改为:


from sklearn.datasets import fetch_mldata

mnist = fetch_mldata('MNIST original',data_home='MNIST_data/') 

本地导入MNIST数据集的结果

这样就可以了

上一篇 下一篇

猜你喜欢

热点阅读