ValueError: Dataset with data_id 554 not found
ValueError: Dataset with data_id 554 not found
我正在对 MNIST 数据集进行分类算法。当我使用 sklearn.datasets
加载数据集时
from sklearn.datasets import fetch_openml
mnist=fetch_openml('mnist_784', version=1)
mnist.keys()
执行这段代码后我遇到了一个很大的错误。
<ipython-input-2-00e245087535> in <module>
----> 1 mnist = fetch_openml('mnist_784', version=1)
/opt/conda/lib/python3.7/site-packages/sklearn/utils/validation.py in inner_f(*args, **kwargs)
70 FutureWarning)
71 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 72 return f(**kwargs)
73 return inner_f
74
/opt/conda/lib/python3.7/site-packages/sklearn/datasets/_openml.py in fetch_openml(name, version, data_id, data_home, target_column, cache, return_X_y, as_frame)
807 # The shape must include the ignored features to keep the right indexes
808 # during the arff data conversion.
--> 809 data_qualities = _get_data_qualities(data_id, data_home)
810 shape = _get_num_samples(data_qualities), len(features_list)
811 else:
/opt/conda/lib/python3.7/site-packages/sklearn/datasets/_openml.py in _get_data_qualities(data_id, data_home)
420 error_message = "Dataset with data_id {} not found.".format(data_id)
421 json_data = _get_json_content_from_openml_api(url, error_message, True,
--> 422 data_home)
423 try:
424 return json_data['data_qualities']['quality']
/opt/conda/lib/python3.7/site-packages/sklearn/datasets/_openml.py in _get_json_content_from_openml_api(url, error_message, raise_if_error, data_home)
168 # 412 error, not in except for nicer traceback
169 if raise_if_error:
--> 170 raise ValueError(error_message)
171 return None
172
ValueError: Dataset with data_id 554 not found.
如何获取数据?
删除 version=1
参数:
mnist = fetch_openml('mnist_784')
代码片段 1
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
代码片段 2
data = fetch_openml('mnist_784')
这两个代码都应该有效。但是通过使用代码片段1,您可以默认提及版本并分配标签和功能。
由于与 fetch_openml.[= 相关的缓存错误,您上面提到的代码无法正常工作。 12=]
我遇到了同样的错误,就我而言,升级 scikit-learn 解决了这个问题。
$pip 安装-U scikit-learn
我的sklearn版本目前是0.24.2。
我正在对 MNIST 数据集进行分类算法。当我使用 sklearn.datasets
加载数据集时from sklearn.datasets import fetch_openml
mnist=fetch_openml('mnist_784', version=1)
mnist.keys()
执行这段代码后我遇到了一个很大的错误。
<ipython-input-2-00e245087535> in <module>
----> 1 mnist = fetch_openml('mnist_784', version=1)
/opt/conda/lib/python3.7/site-packages/sklearn/utils/validation.py in inner_f(*args, **kwargs)
70 FutureWarning)
71 kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 72 return f(**kwargs)
73 return inner_f
74
/opt/conda/lib/python3.7/site-packages/sklearn/datasets/_openml.py in fetch_openml(name, version, data_id, data_home, target_column, cache, return_X_y, as_frame)
807 # The shape must include the ignored features to keep the right indexes
808 # during the arff data conversion.
--> 809 data_qualities = _get_data_qualities(data_id, data_home)
810 shape = _get_num_samples(data_qualities), len(features_list)
811 else:
/opt/conda/lib/python3.7/site-packages/sklearn/datasets/_openml.py in _get_data_qualities(data_id, data_home)
420 error_message = "Dataset with data_id {} not found.".format(data_id)
421 json_data = _get_json_content_from_openml_api(url, error_message, True,
--> 422 data_home)
423 try:
424 return json_data['data_qualities']['quality']
/opt/conda/lib/python3.7/site-packages/sklearn/datasets/_openml.py in _get_json_content_from_openml_api(url, error_message, raise_if_error, data_home)
168 # 412 error, not in except for nicer traceback
169 if raise_if_error:
--> 170 raise ValueError(error_message)
171 return None
172
ValueError: Dataset with data_id 554 not found.
如何获取数据?
删除 version=1
参数:
mnist = fetch_openml('mnist_784')
代码片段 1
X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
代码片段 2
data = fetch_openml('mnist_784')
这两个代码都应该有效。但是通过使用代码片段1,您可以默认提及版本并分配标签和功能。
由于与 fetch_openml.[= 相关的缓存错误,您上面提到的代码无法正常工作。 12=]
我遇到了同样的错误,就我而言,升级 scikit-learn 解决了这个问题。
$pip 安装-U scikit-learn
我的sklearn版本目前是0.24.2。