自动下载和上传数字机器学习比赛的数据
numerapi的Python项目详细描述
numerai python api
自动下载和上传数字机器学习数据 竞争。
这个库是numerai api的python客户端。接口已编程 在python中,允许下载训练数据、上载预测和 访问用户、提交和比赛信息。
如果你遇到问题或有建议,请随时提出问题。
安装
pip install --upgrade numerapi
用法
numerapi可以用作常规的、可导入的python模块,或者从命令 行。
一些操作(如上传预测或立桩)需要一个令牌来验证
实际上是你在和Numerai的API交互。这些代币包括
一个public_id
和secret_key
。两者都可以通过登录numer.ai和
转到帐户->;自定义API密钥。令牌可以传递给python模块
作为参数,或者可以通过环境变量(NUMERAI_PUBLIC_ID
)进行设置
以及NUMERAI_SECRET_KEY
)。
python模块
用法示例:
# some API calls do not require logging in
napi = numerapi.NumerAPI(verbosity="info")
# download current dataset
napi.download_current_dataset(unzip=True)
# get competitions
all_competitions = napi.get_competitions()
# get leaderboard for the current round
leaderboard = napi.get_leaderboard()
# leaderboard for a historic round
leaderboard_67 = napi.get_leaderboard(round_num=67)
# check if a new round has started
if napi.check_new_round():
print("new round has started wihtin the last 24hours!")
else:
print("no new round within the last 24 hours")
# provide api tokens
example_public_id = "somepublicid"
example_secret_key = "somesecretkey"
napi = NumerAPI(example_public_id, example_secret_key)
# upload predictions
submission_id = napi.upload_predictions("preds.csv", tournament=1)
# check submission status
napi.submission_status()
命令行界面
要开始使用cli界面,请查看帮助页:
$ numerapi --help
Usage: numerapi [OPTIONS] COMMAND [ARGS]...
Wrapper around the Numerai API
Options:
--help Show this message and exit.
Commands:
check-new-round Check if a new round has started within the...
competitions Retrieves information about all competitions
current-round Get number of the current active round.
dataset-url Fetch url of the current dataset.
download-dataset Download dataset for the current active...
leaderboard Retrieves the leaderboard for the given...
payments List all your payments
rankings Get the overall rankings.
stake Participate in the staking competition.
stakes List all your stakes.
staking_leaderboard Retrieves the staking competition leaderboard...
submission-filenames Get filenames of your submissions
submission-ids Get dict with username->submission_id...
submission-status checks the submission status
submission-successful Check if the last submission passes...
submit Upload predictions from file.
tournament-name2number Translate tournament name to tournament...
tournament-number2name Translate tournament number to tournament...
tournaments Get all active tournaments.
transactions List all your deposits and withdrawals.
user Get all information about you!
user-activities Get user activities (works for all users!)
version Installed numerapi version.
每个命令都有自己的帮助页,例如:
$ numerapi submit --help
Usage: numerapi submit [OPTIONS] PATH
Upload predictions from file.
Options:
--tournament INTEGER The ID of the tournament, defaults to 1
--help Show this message and exit.
API参考
签出detailed API docs 了解所有可用的方法、参数和返回值。