gpt4 book ai didi

scikit-learn - 无法通过 Anaconda/jupyter 获取 MNIST 数据库

转载 作者:行者123 更新时间:2023-12-03 23:39:31 26 4
gpt4 key购买 nike

胡同学,

我是 python/anaconda/jupyter/numPy、panda 等的新手......所以如果这是一个非常愚蠢的问题,请原谅我。
我正在尝试使用 anaconda/jupyter 获取 MNIST 数据库。但是每次我在最后收到 HTTP 错误 500 时。这真的是服务器问题(如 500 所建议的)还是我做错了什么?

在 jupyter 中输入:

from sklearn.datasets import fetch_mldata
mnist = fetch_mldata('MNIST original')

结果:
    ---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
<ipython-input-1-15dc285fb373> in <module>()
1 from sklearn.datasets import fetch_mldata
----> 2 mnist = fetch_mldata('MNIST original')

e:\ProgramData\Anaconda3\lib\site-packages\sklearn\datasets\mldata.py in fetch_mldata(dataname, target_name, data_name, transpose_data, data_home)
140 urlname = MLDATA_BASE_URL % quote(dataname)
141 try:
--> 142 mldata_url = urlopen(urlname)
143 except HTTPError as e:
144 if e.code == 404:

e:\ProgramData\Anaconda3\lib\urllib\request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
221 else:
222 opener = _opener
--> 223 return opener.open(url, data, timeout)
224
225 def install_opener(opener):

e:\ProgramData\Anaconda3\lib\urllib\request.py in open(self, fullurl, data, timeout)
530 for processor in self.process_response.get(protocol, []):
531 meth = getattr(processor, meth_name)
--> 532 response = meth(req, response)
533
534 return response

e:\ProgramData\Anaconda3\lib\urllib\request.py in http_response(self, request, response)
640 if not (200 <= code < 300):
641 response = self.parent.error(
--> 642 'http', request, response, code, msg, hdrs)
643
644 return response

e:\ProgramData\Anaconda3\lib\urllib\request.py in error(self, proto, *args)
562 http_err = 0
563 args = (dict, proto, meth_name) + args
--> 564 result = self._call_chain(*args)
565 if result:
566 return result

e:\ProgramData\Anaconda3\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
502 for handler in handlers:
503 func = getattr(handler, meth_name)
--> 504 result = func(*args)
505 if result is not None:
506 return result

e:\ProgramData\Anaconda3\lib\urllib\request.py in http_error_302(self, req, fp, code, msg, headers)
754 fp.close()
755
--> 756 return self.parent.open(new, timeout=req.timeout)
757
758 http_error_301 = http_error_303 = http_error_307 = http_error_302

e:\ProgramData\Anaconda3\lib\urllib\request.py in open(self, fullurl, data, timeout)
530 for processor in self.process_response.get(protocol, []):
531 meth = getattr(processor, meth_name)
--> 532 response = meth(req, response)
533
534 return response

e:\ProgramData\Anaconda3\lib\urllib\request.py in http_response(self, request, response)
640 if not (200 <= code < 300):
641 response = self.parent.error(
--> 642 'http', request, response, code, msg, hdrs)
643
644 return response

e:\ProgramData\Anaconda3\lib\urllib\request.py in error(self, proto, *args)
568 if http_err:
569 args = (dict, 'default', 'http_error_default') + orig_args
--> 570 return self._call_chain(*args)
571
572 # XXX probably also want an abstract factory that knows when it makes

e:\ProgramData\Anaconda3\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
502 for handler in handlers:
503 func = getattr(handler, meth_name)
--> 504 result = func(*args)
505 if result is not None:
506 return result

e:\ProgramData\Anaconda3\lib\urllib\request.py in http_error_default(self, req, fp, code, msg, hdrs)
648 class HTTPDefaultErrorHandler(BaseHandler):
649 def http_error_default(self, req, fp, code, msg, hdrs):
--> 650 raise HTTPError(req.full_url, code, msg, hdrs, fp)
651
652 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 500: INTERNAL SERVER ERROR

最佳答案

聚会迟到了,但我遇到了同样的错误,我的简单解决方案是分别运行这两个命令,例如:

from sklearn import datasets

并确保您在 jupyter notebook 的单独一行中运行它
mnist_data = datasets.fetch_mldata('MNIST original', data_home = 'datasets/')

关于scikit-learn - 无法通过 Anaconda/jupyter 获取 MNIST 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43149272/

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