为什么我会收到以下 connectionreseterror for mnist = fetch_mldata?
Why am I getting the following connectionreseterror for mnist = fetch_mldata?
每当我尝试从 mnist 获取数据时,我都会收到连接重置错误,不确定为什么 happening.This 是 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
fetch_mldata
是 deprecated since scikit-learn v0.20, and replaced with fetch_openml
;以下是您应该如何在 v0.21 中将其用于 MNIST:
from sklearn.datasets import fetch_openml
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
请参阅 example 的文档。
每当我尝试从 mnist 获取数据时,我都会收到连接重置错误,不确定为什么 happening.This 是 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
fetch_mldata
是 deprecated since scikit-learn v0.20, and replaced with fetch_openml
;以下是您应该如何在 v0.21 中将其用于 MNIST:
from sklearn.datasets import fetch_openml
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
请参阅 example 的文档。