python - 如何针对 openml.org 进行身份验证
问题描述
我正在尝试运行openml基准测试,它正确地要求提供 API 密钥。问题是我在 API 文档中找不到如何提供该密钥。
用户指南说:
import openml
from sklearn import impute, tree, pipeline
# Define a scikit-learn classifier or pipeline
clf = pipeline.Pipeline(
steps=[
('imputer', impute.SimpleImputer()),
('estimator', tree.DecisionTreeClassifier())
]
)
# Download the OpenML task for the german credit card dataset with 10-fold
# cross-validation.
task = openml.tasks.get_task(31)
# Run the scikit-learn model on the task.
run = openml.runs.run_model_on_task(clf, task)
# Publish the experiment on OpenML (optional, requires an API key.
# You can get your own API key by signing up to OpenML.org)
run.publish()
print(f'View the run online: {openml.config.server}/run/{run.run_id}')
但它没有指定我应该如何提供该密钥。
解决方案
这解释了如何配置 OpenML: https ://openml.github.io/openml-python/master/examples/20_basic/introduction_tutorial.html#sphx-glr-examples-20-basic-introduction-tutorial-py
确实最好将您的密钥存储在本地文件中。您还可以通过编程方式设置它以进行快速测试(但永远不要共享您的 API 密钥!):
openml.config.apikey = 'YOURKEY'
推荐阅读
- python - shlex.split() : How to keep quotes around sub-strings and not split by in-sub-string whitespace?
- python-3.x - 如何根据边缘数据将实体聚合成组?
- apache-flink - Flink中不同savepoint触发器的区别
- java - 为什么在我的代码中添加此行后我的应用程序无法打开:TextView t = findViewById(R.id.wina)"?
- python - Django 表单数据检索和更新问题
- 3d - [画]; 绘制 3d 球体
- hive - Hive+Tez 作业性能问题
- android - 在android中将html转换为文本
- python - 熊猫数据框数据操作
- apache-spark - 如何在 spark config 中覆盖 Google 服务帐户凭据?