gpt4 book ai didi

python-2.7 - 在sklearn中使用datasets.fetch_mldata()时出现IO错误

转载 作者:行者123 更新时间:2023-11-30 08:44:23 27 4
gpt4 key购买 nike

我导入了 fetch_mldata从 sklearn.datasets 导入 fetch_mldata并称:

dataset = fetch_mldata('MNIST original')

但我得到的是以下内容:

> Traceback (most recent call last):   File "<stdin>", line 1, in
> <module> File
> "C:\Users\Jacob\Development\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> line 540, in runfile
> execfile(filename, namespace) File "C:/Users/Jacob/Documents/Dropbox/Technion/Semester 8/Machine
> learning/Demo3/Demo3.py", line 75, in <module>
> dataset = fetch_mldata('MNIST original') File "C:\Users\Jacob\Development\Anaconda\lib\site-packages\sklearn\datasets\mldata.py",
> line 158, in fetch_mldata
> matlab_dict = io.loadmat(matlab_file, struct_as_record=True) File
> "C:\Users\Jacob\Development\Anaconda\lib\site-packages\scipy\io\matlab\mio.py",
> line 126, in loadmat
> matfile_dict = MR.get_variables(variable_names) File "C:\Users\Jacob\Development\Anaconda\lib\site-packages\scipy\io\matlab\mio5.py",
> line 288, in get_variables
> res = self.read_var_array(hdr, process) File "C:\Users\Jacob\Development\Anaconda\lib\site-packages\scipy\io\matlab\mio5.py",
> line 248, in read_var_array
> return self._matrix_reader.array_from_header(header, process) File "mio5_utils.pyx", line 616, in
> scipy.io.matlab.mio5_utils.VarReader5.array_from_header
> (scipy\io\matlab\mio5_utils.c:5903) File "mio5_utils.pyx", line 645,
> in scipy.io.matlab.mio5_utils.VarReader5.array_from_header
> (scipy\io\matlab\mio5_utils.c:5332) File "mio5_utils.pyx", line 713,
> in scipy.io.matlab.mio5_utils.VarReader5.read_real_complex
> (scipy\io\matlab\mio5_utils.c:6323) File "mio5_utils.pyx", line 417,
> in scipy.io.matlab.mio5_utils.VarReader5.read_numeric
> (scipy\io\matlab\mio5_utils.c:3873) File "mio5_utils.pyx", line 353,
> in scipy.io.matlab.mio5_utils.VarReader5.read_element
> (scipy\io\matlab\mio5_utils.c:3595) File "streams.pyx", line 324, in
> scipy.io.matlab.streams.FileStream.read_string
> (scipy\io\matlab\streams.c:4343) IOError: could not read bytes

我尝试下载较新版本的 sklearn,但没有帮助。我有另一个关于这个问题的帖子,但那里提供的解决方案对我没有帮助。 How to use datasets.fetch_mldata() in sklearn?

有什么想法吗?

最佳答案

供您/其他人引用,我遇到了几乎相同的错误(Ubuntu),包括“IOError:无法读取字节”错误。

我刚刚发布了一个解决方案

How to use datasets.fetch_mldata() in sklearn?

简短回答 - 使用以下内容:

from sklearn.datasets.mldata import fetch_mldata
data = fetch_mldata('mnist-original')

dataset = fetch_mldata('mnist-original', data_home='***')

将 ***(保留引号)替换为您的首选位置(数据目录)。

关于python-2.7 - 在sklearn中使用datasets.fetch_mldata()时出现IO错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26102261/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com