Sklearn solve the problem in the use of data sets MNIST can not be obtained (WinError 10060)

Today in learning PCA using mnist datasets encountered a problem, the code is this:

1 import numpy as np
2 from sklearn.datasets import fetch_mldata
3 
4 mnist = fetch_mldata("MNIST original")

We encountered an error: [WinError 10060] Since the connected party did not properly respond after a period of time or host connections did not respond, the connection attempt fails.

 

 

the reason:

That is the source address is the wall, and then take the ladder to try, the result was not

Search, I reason, because the source address is not used

Solution:

Use local data sets can be downloaded from:  https://github.com/amplab/datascience-sp14/raw/master/lab7/mldata/mnist-original.mat

The fast enough, I can use the Baidu cloud link:

Link: https: //pan.baidu.com/s/1NH1VSnX_Bkvr3k-Dku4gAw
extraction code: herq

After downloading using fetch_mldata good data_home parameter specifies the file directory

E.g:

  My Jupyter files in F:, in which a new datasets, and specified in the code \ PyCharmWorkSpace under \ ML

 mnist = fetch_mldata("MNIST original",data_home='./datasets')

Until then run, or will complain, do not worry

Open the folder datasets found

Such a subdirectory, the downloaded files into it to go inside, running, OK

 

Guess you like

Origin www.cnblogs.com/VitoLin21/p/11370039.html