【发布时间】:2022-02-25 23:37:07
【问题描述】:
我正在学习 sklearn,但我无法使用 fetch_openml()。它说,
ImportError: 无法从“sklearn.datasets”导入名称“fetch_openml”
【问题讨论】:
-
fetch_openml()已被弃用。你的 scikit-learn 版本是多少?
标签: scikit-learn
我正在学习 sklearn,但我无法使用 fetch_openml()。它说,
ImportError: 无法从“sklearn.datasets”导入名称“fetch_openml”
【问题讨论】:
fetch_openml() 已被弃用。你的 scikit-learn 版本是多少?
标签: scikit-learn
在新版本的 sklearn 中,获取开放的 ML 数据集变得更加容易。例如,您可以将导入和获取 mnist 数据集添加为:
from sklearn.datasets import fetch_openml
X, y = fetch_openml('mnist_784', version=1, return_X_y=True, as_frame=False)
print(X.shape, y.shape)
更多详情请查看official example。
【讨论】:
你可以用这个:
from sklearn.datasets import fetch_openml
【讨论】:
要在 jupyter 中解决这个问题,请按照以下步骤操作:
从“https://osf.io/jda6s/"”下载文件 mnist-original
下载文件后将其复制到 C:\Users\YOURUSERNAME\scikit_learn_data\mldata
在笔记本 jupyter 中执行:
from sklearn.datasets import fetch_mldata
mnist = fetch_mldata('mnist-original')
【讨论】: