Skip to main content

Openbayes Service Tool

Project description

openbayestool

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

快速开始

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

from openbayestool import log_param, log_metric, clear_metric, clear_param

# 记录参数 `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)

# 清理一个自定义的 metric
clear_metric('precision')

# 清理一个自定义的 param
clear_param('foo')

安装

注意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, clear_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)

# 清理一个自定义的 metric
clear_metric('precision')

查看记录结果

在 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.3.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

openbayestool-0.3.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openbayestool-0.3.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.8.0 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for openbayestool-0.3.2.tar.gz
Algorithm Hash digest
SHA256 fac7d4796735176a2cc6a025c02d8e81d8a05eb2ba225ddd8175279980430c89
MD5 fec89ffaba1e807c44964e88c7731974
BLAKE2b-256 75a18eeb2cc9f1d2beec9c83fa473320d5f3d56b5e9bfe33486056dfcb1d5688

See more details on using hashes here.

File details

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

File metadata

  • Download URL: openbayestool-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.8.0 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for openbayestool-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bdb34b327d659ed4567d80d58ccfd6b040b86a3fd2f9ca104ce5e7758b764832
MD5 995e54e9cb3a01e9bb03ae7ac317b725
BLAKE2b-256 a2c9049c16b9c773419111df8f68c0cda545c02fe417d0dfae126ccbf39caed5

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