
本教程旨在指导用户如何高效获取机器学习领域主要会议(如neurips、icml、cvpr)的论文数据。文章将详细介绍针对2023年及以后会议,应使用openreview的最新api版本(openreview.api.openreviewclient配合api2.openreview.net端点)来访问数据。同时,针对部分会议(如cvpr 2023),当openreview api不适用时,本教程将提供基于python的网页抓取方案,帮助用户从会议官方开放访问网站提取所需信息。
OpenReview平台作为许多学术会议的论文提交和评审系统,提供了API供研究者获取会议数据。然而,随着平台的发展,其API也经历了版本迭代。对于2023年及以后的会议数据,传统的openreview.Client类和https://api.openreview.net端点可能无法正常工作,导致返回空列表或“Group Not Found”错误。
为了成功访问最新的会议数据,需要使用openreview.api.OpenReviewClient类,并将其baseurl参数指向新的API端点:https://api2.openreview.net。
本节将演示如何使用更新后的OpenReview API来获取NeurIPS 2023等会议的论文标题。
首先,确保您的Python环境中安装了openreview库。如果尚未安装,可以使用pip进行安装:
pip install openreview
以下代码展示了如何使用openreview.api.OpenReviewClient获取NeurIPS 2023的论文标题:
import openreview
# 实例化新的OpenReview API客户端
# 注意:baseurl应指向api2.openreview.net
client = openreview.api.OpenReviewClient(baseurl='https://api2.openreview.net')
# 获取指定会议的所有投稿
# 'venueid'是识别会议的关键,格式通常为 '会议名称.cc/年份/Conference'
submissions = client.get_all_notes(content={'venueid':'NeurIPS.cc/2023/Conference'})
# 从投稿对象中提取论文标题
papers_titles = [s.content['title']['value'] for s in submissions]
# 打印前10个标题进行验证
print("NeurIPS 2023 论文标题(前10个):")
for title in papers_titles[:10]:
print(f"- {title}")运行上述代码,您将获得类似以下的输出:
NeurIPS 2023 论文标题(前10个): - Online PCA in Converging Self-consistent Field Equations - Don’t blame Dataset Shift! Shortcut Learning due to Gradients and Cross Entropy - On Slicing Optimality for Mutual Information - k-Median Clustering via Metric Embedding: Towards Better Initialization with Differential Privacy - Information Maximization Perspective of Orthogonal Matching Pursuit with Applications to Explainable AI - STEVE-1: A Generative Model for Text-to-Behavior in Minecraft - AMAG: Additive, Multiplicative and Adaptive Graph Neural Network For Forecasting Neuron Activity - Conditional Matrix Flows for Gaussian Graphical Models - Representational Strengths and Limitations of Transformers - Cappy: Outperforming and Boosting Large Multi-Task LMs with a Small Scorer
注意事项:
并非所有会议都将所有公共数据通过OpenReview API完全暴露,或者它们可能选择使用其他平台发布其开放访问内容。例如,CVPR 2023虽然使用了OpenReview进行评审,但其公开的论文标题等信息主要发布在自己的开放访问网站上。在这种情况下,网页抓取(Web Scraping)是一个有效的替代方案。
我们将使用requests库来发送HTTP请求获取网页内容,并使用lxml库来解析HTML文档并提取数据。
首先,确保安装了这些库:
pip install requests lxml
以下代码演示了如何从CVPR 2023的开放访问网站抓取论文标题:
import requests
from lxml.html import fromstring
# 目标网页URL
url = 'https://openaccess.thecvf.com/CVPR2023?day=all'
# 发送HTTP GET请求获取网页内容
response_text = requests.get(url).text
# 使用lxml解析HTML内容
response_html = fromstring(response_text)
# 使用XPath表达式选择论文标题元素
# 这里的XPath '/html/body/dl/dt/a/text()' 是根据目标网页的HTML结构确定的
# 它定位到 <dt> 标签下的 <a> 标签的文本内容
elements = response_html.xpath('//*[@id="content"]/dl/dt/a/text()')
# 打印前10个标题进行验证
print("\nCVPR 2023 论文标题(前10个):")
for title in elements[:10]:
print(f"- {title}")运行上述代码,您将获得类似以下的输出:
CVPR 2023 论文标题(前10个): - GFPose: Learning 3D Human Pose Prior With Gradient Fields - CXTrack: Improving 3D Point Cloud Tracking With Contextual Information - Deep Frequency Filtering for Domain Generalization - Frame Flexible Network - Unsupervised Cumulative Domain Adaptation for Foggy Scene Optical Flow - NoisyTwins: Class-Consistent and Diverse Image Generation Through StyleGANs - DisCoScene: Spatially Disentangled Generative Radiance Fields for Controllable 3D-Aware Scene Synthesis - Revisiting Self-Similarity: Structural Embedding for Image Retrieval - Minimizing the Accumulated Trajectory Error To Improve Dataset Distillation - Decoupling-and-Aggregating for Image Exposure Correction
注意事项:
获取学术会议论文数据需要灵活运用不同的工具和方法:
始终建议首先查阅会议的官方网站或OpenReview页面,了解其数据发布方式和可用的API文档,以选择最合适的数据获取策略。
以上就是利用OpenReview API与网页抓取获取会议论文数据教程的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号