Skip to main content

Openbayes Service Tool

Project description

## 快速开始

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

```python
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)
```

## 安装

```shell
pip install -U openbayestool
```

## 使用

**注意** 在 openbayes 所提交的任务会自动设置 **服务器以及相应的账号密码** 和 **要记录的容器的 url** 无需用户知晓。

### 设置服务器以及相应的账号密码

通过环境变量设置如下变量:

```
UAA_TOKEN_URL=http://<server-url>/users/login
UAA_USERNAME=<username>
UAA_PASSWORD=<password>
```

### 设置要记录的容器的 url

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

```python
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 记录 `parameters` 和 `metrics`

```python
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 的 models 会展现以上的记录结果并作为自动建模确认下一步参数的依据。

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.1.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

openbayestool-0.1.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for openbayestool-0.1.3.tar.gz
Algorithm Hash digest
SHA256 680eed0d6032c5330c704e757d766868f2368eac30389de900e257e523e6f173
MD5 217f6ae7f070952ca0164682071a638f
BLAKE2b-256 1cfc29e531cbe04c05ef9222eb19c6c64e4269cf569ae87ca517c488adb0188d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for openbayestool-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 70a9bcc59ab634505f3da470bc351061ec112a7a607288a2ffb32a4d4c8dffd5
MD5 54a3c2a100c9c599634608ec8b590d5f
BLAKE2b-256 029f7fe17d7d2012651e935e1883ab41f362945613cd9bb0dcc6039514ebe347

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