【问题标题】:Error with loading data using StellarGraph使用 StellarGraph 加载数据时出错
【发布时间】:2021-10-24 11:15:55
【问题描述】:

我在 Colab 上多次运行这段代码没有问题,

import stellargraph as sg
from IPython.display import display, HTML
dataset = sg.datasets.Cora()
display(HTML(dataset.description))
G, node_subjects = dataset.load()

但是突然出现这个错误

HTTPError: HTTP Error 403: Forbidden

【问题讨论】:

  • 我输入 {User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36 Edg/90.0.818.46}但获得无效的语法错误
  • 我试过这个代码import requestsdataset = sg.datasets.Cora()url='http://<stellargraph.datasets.datasets.Cora>'headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 Edg/92.0.902.73'}display(HTML(dataset.description))G, node_subjects = requests.get(url, headers=headers)
  • 出现这个错误 HTTPConnectionPool(host='%3cstellargraph.datasets.datasets.cora%3e', port=80): Max retries exceeded with url: / (Caused by NewConnectionError(':无法建立新连接:[Errno -2] Name or service not known'))

标签: python http-status-code-403 loaddata


【解决方案1】:

出现这个是因为 url 不再有效,

检查源代码,https://github.com/stellargraph/stellargraph/blob/9370caed1137c2527523a39212072df1760ca00f/stellargraph/datasets/datasets.py#L104

将网址粘贴到浏览器中也会给你 403

最终原因似乎是这所大学删除了所有数据或限制所有人查看它,检查 https://linqs-data.soe.ucsc.edu/

cora 数据集可以在 https://people.cs.umass.edu/~mccallum/data/https://web.archive.org/web/20150918182409/http://www.cs.umd.edu/~sen/lbc-proj/data/cora.tgz 找到

或者您可以选择使用其他数据集进行链接预测,wn18 等

【讨论】:

  • 代码已经运行,没有任何编辑。
  • 是的,他们的数据库又恢复了。
猜你喜欢
  • 1970-01-01
  • 2020-11-14
  • 1970-01-01
  • 2017-10-22
  • 2021-11-28
  • 2021-09-08
  • 1970-01-01
  • 2015-06-13
  • 1970-01-01
相关资源
最近更新 更多