【问题标题】:MNIST dataset loadin:ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote hostMNIST 数据集加载:ConnectionResetError:[WinError 10054] 远程主机强制关闭现有连接
【发布时间】:2019-08-21 21:08:54
【问题描述】:

我正在尝试从 MNIST 数据集中加载数据。我在我的机器上使用 python 3.6 和 jupyter notebook。

我正在使用下面的代码,但每次都给我错误。请用简单的语言帮助理解此错误的含义以及如何解决此问题。

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 在 0.20 版本中已弃用,将在 0.22enter code here 版本中删除 warnings.warn(味精,类别=弃用警告) 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 在 0.20 版中已弃用,将在 0.22 版中删除 warnings.warn(msg, category=DeprecationWarning)

TimeoutError: [WinError 10060] 连接尝试失败,因为连接方在一段时间后没有正确响应,或者连接失败,因为连接的主机没有响应

【问题讨论】:

标签: python


【解决方案1】:

fetch_mldata()”永远消失了/已弃用[1] 并被“fetch_openml() [2] 取代。以下使用Python 3.7.3 在 macOS Mojave 上工作。

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)

如果这在 SSL 证书 [345] 上出现错误,则(在 Mac 上)输入终端:

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

注意:“3.7”因为这是安装在 Jupyter Notebook 中的版本。要检查 Python 的版本,请在单元格 [6] 中运行:

from platform import python_version
print(python_version())

【讨论】:

    猜你喜欢
    • 2020-04-20
    • 2018-01-02
    • 2016-10-20
    • 2015-02-28
    • 2015-05-24
    • 1970-01-01
    • 2020-10-09
    • 2023-03-26
    • 1970-01-01
    相关资源
    最近更新 更多