为什么我得到以下mnist = fetch_mldata的connectionreseterror?

时间:2019-07-16 16:07:08

标签: python scikit-learn mnist

每当我尝试从mnist提取数据时都会收到一个connectionreseterror,不确定为什么会发生。这是sklearn的教程,用于进行PCA和t-sne数据降维。我以为这可能是python版本的问题,但在2.6、3.5或3.7中不起作用

from sklearn.datasets import fetch_mldata

mnist = fetch_mldata("MNIST original")
X = mnist.data / 255.0
y = mnist.target

ConnectionResetError                      Traceback (most recent call last)
<ipython-input-11-781ac9f03cc8> in <module>()
----> 1 mnist = fetch_mldata("MNIST original")
      2 X = mnist.data / 255.0
      3 y = mnist.target

/anaconda3/envs/py35/lib/python3.5/site-packages/sklearn/datasets/mldata.py in fetch_mldata(dataname, target_name, data_name, transpose_data, data_home)
    152         urlname = MLDATA_BASE_URL % quote(dataname)
    153         try:
--> 154             mldata_url = urlopen(urlname)
    155         except HTTPError as e:
    156             if e.code == 404:

ConnectionResetError: [Errno 54] Connection reset by peer

1 个答案:

答案 0 :(得分:0)

从scikit-learn v0.20开始,

fetch_mldatadeprecated,并由fetch_openml代替;在v0.21中,应该将其用于MNIST:

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

请参阅example的文档。

相关问题