Skip to content

Commit

Permalink
Merge pull request #20 from State-of-The-MLOps/feature/readme
Browse files Browse the repository at this point in the history
Feature/readme
  • Loading branch information
chl8469 authored Sep 16, 2021
2 parents 2858627 + 06139e3 commit 415c551
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# MLOps
๐Ÿ‘Š Build MLOps system step by step ๐Ÿ‘Š
๐Ÿ‘Š Build MLOps system step by step ๐Ÿ‘Š

## ๋ฌธ์„œ

- [API DOCS](./docs/api-list.md)
6 changes: 3 additions & 3 deletions app/api/router/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)


@router.put("/")
@router.put("/insurance")
def train_insurance(
PORT: int = 8080,
experiment_sec: int = 20,
Expand Down Expand Up @@ -90,7 +90,7 @@ def train_atmos(expr_name: str):
"nnictl create --port {} --config {}/config.yml".format(
nni_port, expr_path))
sucs_msg = "Successfully started experiment!"

if sucs_msg in nni_create_result:
p = re.compile(r"The experiment id is ([a-zA-Z0-9]+)\n")
expr_id = p.findall(nni_create_result)[0]
Expand All @@ -109,4 +109,4 @@ def train_atmos(expr_name: str):

except Exception as e:
L.error(e)
return {'error': str(e)}
return {'error': str(e)}
146 changes: 146 additions & 0 deletions docs/api-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# API List

API_URL : 127.0.0.1

- [API List](#api-list)
- [Train](#train)
- [Insurance](#insuranceํ›ˆ๋ จ)
- [Temperature](#Temperatureํ›ˆ๋ จ)
- [Prediction](#predict)
- [Insurance](#insurance์˜ˆ์ธก)
- [Temperature](#Temperature์˜ˆ์ธก)


## Train

### Insuranceํ›ˆ๋ จ

#### ์š”์ฒญ

```
PUT {{API_URL}}/train/insurance
```

| ํŒŒ๋ผ๋ฏธํ„ฐ | ํŒŒ๋ผ๋ฏธํ„ฐ ์œ ํ˜• | ๋ฐ์ดํ„ฐ ํƒ€์ž… | ํ•„์ˆ˜ ์—ฌ๋ถ€ | ์„ค๋ช… |
| --------------- | ------------- | ----------- | --------- | ----------------------- |
| `PORT` | `body` | `int` | `(default) 8080` | NNi ํฌํŠธ๋ฒˆํ˜ธ |
| `experiment_sec` | `body` | `int` | `(default) 20` | ํ•™์Šต์‹œ๊ฐ„(์ดˆ) |
| `experiment_name` | `body` | `str` | `(default) exp1` | ํ•™์Šต์ด๋ฆ„ |
| `experimenter` | `body` | `str` | `(default) DongUk` | ์—ฐ๊ตฌ์ž ์ด๋ฆ„ |
| `model_name` | `body` | `str` | `(default) insurance_fee_model` | ํ•™์Šต ๋ชจ๋ธ ์ด๋ฆ„ |
| `version` | `body` | `float` | `(default) 0.1` | ๋ชจ๋ธ ๋ฒ„์ „ |


<br/>

#### ์‘๋‹ต

| ํ‚ค | ๋ฐ์ดํ„ฐ ํƒ€์ž… | ์„ค๋ช… |
| -------------- | ----------- | ------------- |
| `msg` | `string` | NNi์‹คํ—˜์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ๋งํฌ์ฃผ์†Œ |
| `error` | `string` | ์—๋Ÿฌ๋‚ด์šฉ |


```jsonc
{
"result": 'Check out {{API_URL}}:{PORT}',
}
{
"error": "Error info"
}
```


### Temperatureํ›ˆ๋ จ

#### ์š”์ฒญ

| ํŒŒ๋ผ๋ฏธํ„ฐ | ํŒŒ๋ผ๋ฏธํ„ฐ ์œ ํ˜• | ๋ฐ์ดํ„ฐ ํƒ€์ž… | ํ•„์ˆ˜ ์—ฌ๋ถ€ | ์„ค๋ช… |
| --------------- | ------------- | ----------- | --------- | ----------------------- |
| `expr_name` | `body` | `string` | โœ… | ํ•™์Šต์ด๋ฆ„ |


<br/>

#### ์‘๋‹ต

| ํ‚ค | ๋ฐ์ดํ„ฐ ํƒ€์ž… | ์„ค๋ช… |
| -------------- | ----------- | ------------- |
| `error` | `string` | ์—๋Ÿฌ๋‚ด์šฉ |

```jsonc
{
"error": "Error info"
}
```

## Predict

### Insurance์˜ˆ์ธก

#### ์š”์ฒญ

```
PUT {{API_URL}}/predict/insurance
```

| ํŒŒ๋ผ๋ฏธํ„ฐ | ํŒŒ๋ผ๋ฏธํ„ฐ ์œ ํ˜• | ๋ฐ์ดํ„ฐ ํƒ€์ž… | ํ•„์ˆ˜ ์—ฌ๋ถ€ | ์„ค๋ช… |
| --------------- | ------------- | ----------- | --------- | ----------------------- |
| `age` | `body` | `int` | โœ… | ๋‚˜์ด |
| `sex` | `body` | `int` | โœ… | ์„ฑ๋ณ„ |
| `bmi` | `body` | `float` | โœ… | bmi์ˆ˜์น˜ |
| `children` | `body` | `int` | โœ… | ์ž๋…€ ์ˆ˜ |
| `smoker` | `body` | `int` | โœ… | ํก์—ฐ์—ฌ๋ถ€ |
| `region` | `body` | `int` | โœ… | ๊ฑฐ์ฃผ์ง€์—ญ |

<br/>

#### ์‘๋‹ต

| ํ‚ค | ๋ฐ์ดํ„ฐ ํƒ€์ž… | ์„ค๋ช… |
| -------------- | ----------- | ------------- |
| `result` | `float` | ์˜ˆ์ธก๋œ ๋ณดํ—˜๋ฃŒ ๊ฐ’ |
| `error` | `string` | ์—๋Ÿฌ๋‚ด์šฉ |


```jsonc
{
"result": 3213.123,
}
{
"error": "Error info"
}
```


### Temperature์˜ˆ์ธก

#### ์š”์ฒญ

```
PUT {{API_URL}}/predict/atmos
```

| ํŒŒ๋ผ๋ฏธํ„ฐ | ํŒŒ๋ผ๋ฏธํ„ฐ ์œ ํ˜• | ๋ฐ์ดํ„ฐ ํƒ€์ž… | ํ•„์ˆ˜ ์—ฌ๋ถ€ | ์„ค๋ช… |
| --------------- | ------------- | ----------- | --------- | ----------------------- |
| `time_series` | `body` | `List[float]` | โœ… | 72์ผ๊ฐ„์˜ ์˜จ๋„๋ฐ์ดํ„ฐ |


<br/>

#### ์‘๋‹ต

| ํ‚ค | ๋ฐ์ดํ„ฐ ํƒ€์ž… | ์„ค๋ช… |
| -------------- | ----------- | ------------- |
| x | `List[float]` | ์˜ˆ์ธก๋œ ํ–ฅํ›„ 24์ผ๊ฐ„ ์˜จ๋„๊ฐ’ |
| `error` | `string` | ์—๋Ÿฌ๋‚ด์šฉ |


```jsonc
{
[32.32, 33.32, 34.11...]
}
{
"error": "Error info"
}
```

0 comments on commit 415c551

Please sign in to comment.