0

I am trying to load data from MNIST data set. I am using python 3.6 with jupyter notebook on my machine.

I am using the below code but it is giving me error every time. Please help to understand what is the meaning of this error in simple language and how can I resolve this issue.

from sklearn.datasets import fetch_mldata
mnist = fetch_mldata('MNIST original')

c:\users\gaurav_pendhari\appdata\local\programs\python\python37\lib\site-packages\sklearn\utils\deprecation.py:77: DeprecationWarning: Function fetch_mldata is deprecated; fetch_mldata was deprecated in version 0.20 and will be removed in version 0.22enter code here warnings.warn(msg, category=DeprecationWarning) c:\users\gaurav_pendhari\appdata\local\programs\python\python37\lib\site-packages\sklearn\utils\deprecation.py:77: DeprecationWarning: Function mldata_filename is deprecated; mldata_filename was deprecated in version 0.20 and will be removed in version 0.22 warnings.warn(msg, category=DeprecationWarning)

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

  • This looks relevant, especially the information at the bottom: https://github.com/ageron/handson-ml/issues/7 – MandyShaw Mar 31 '19 at 17:49

1 Answers1

0

The 'fetch_mldata()' is gone for good/deprecated[1] and is replaced by 'fetch_openml()' [2]. The following worked on macOS Mojave with Python 3.7.3.

from sklearn.datasets import fetch_openml
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
# or #
mnist = fetch_openml('mnist_784', version=1)

If this gives an error on SSL certificate [3, 4, 5], then (on mac) type in terminal:

$sudo /Applications/Python\ 3.7/Install\ Certificates.command

Note: "3.7" because that was the version installed in Jupyter Notebook. To check version of Python run this in a cell [6]:

from platform import python_version
print(python_version())
Nilesh Ingle
  • 1,485
  • 9
  • 15