Skip to main content

Openbayes Service Tool

Project description

openbayestool

该工具用于 OpenBayes 下参数、指标的记录。

快速开始

该类库将会把模型执行过程中的 parametersmetrics 提交到 openbayes-server 方便记录每次模型的结果。

from openbayestool import log_param, log_metric

# 记录参数 `learning_rate=0.01`
log_param('learning_rate', 0.01)

# 同一参数将会记录最后一个请求的结果 `foo=3`
log_param('foo', 1)
log_param('foo', 2)
log_param('foo', 3)

# 记录模型的运行结果 `precision=0.77`
log_metric('precision', 0.77)

# 同一个结果 precision 多次记录会追加结果,即结果为 [0.79, 0.82, 0.86]
log_metric('precision', 0.79)
log_metric('precision', 0.82)
log_metric('precision', 0.86)

安装

注意OpenBayes 内无需安装,默认已经引入了该依赖。

pip install -U openbayestool

使用

注意 在 openbayes 所提交的任务会自动设置 API 访问 token要记录的容器的 url 无需用户知晓。

设置要记录的容器的 url

可以通过环境变量配置:JOB_UPDATE_URL=<job-url>,也可以在程序中采用 api 配置:

from openbayestool import set_callback_url, get_callback_url

set_callback_url('<job-url>') # set the job-url
get_callback_url() # return the job-url

设置访问 API 的 token

可以通过环境变量 JOB_ACCESS_TOKEN=<job-token> 配置,也可以在程序中采用 api 配置:

from openbayestool import set_access_token, get_access_token

set_access_token('<job-token>') # set the job-token
get_access_token() # return the job-token

通过 api 记录 parametersmetrics

from openbayestool import log_param, log_metric

# 记录参数 `learning_rate=0.01`
log_param('learning_rate', 0.01)

# 同一参数将会记录最后一个请求的结果 `foo=3`
log_param('foo', 1)
log_param('foo', 2)
log_param('foo', 3)

# 记录模型的运行结果 `precision=0.77`
log_metric('precision', 0.77)

# 同一个结果 precision 多次记录会追加结果,即结果为 [0.79, 0.82, 0.86]
log_metric('precision', 0.79)
log_metric('precision', 0.82)
log_metric('precision', 0.86)

查看记录结果

在 openbayes 的容器页面会展现以上的记录结果并作为自动建模确认下一步参数的依据。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openbayestool-0.2.6.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

openbayestool-0.2.6-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file openbayestool-0.2.6.tar.gz.

File metadata

  • Download URL: openbayestool-0.2.6.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.4

File hashes

Hashes for openbayestool-0.2.6.tar.gz
Algorithm Hash digest
SHA256 e35eef7966402c2e1bddb0ac1251deebe46916b12a26c63922609629567bc2d3
MD5 a9adc84393b5ae27cbf4baaa7b8b8517
BLAKE2b-256 4267d97f2f46a1cf2607419e83c8d9a82137e281b4804939c1b9a73acee39e79

See more details on using hashes here.

File details

Details for the file openbayestool-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: openbayestool-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.4

File hashes

Hashes for openbayestool-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d27f86b8d2e5a119aa56497ee2e1d2cb60553ed280908777ac4c9634870e3084
MD5 06d8f58c3b7f28f98677d8254d177627
BLAKE2b-256 c6179d728abf0383baf7de1fdcbb31f1ee5a2d74d39d8bc2901044f3b4fd0467

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page