Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Wh1isper authored and wunder957 committed Aug 11, 2023
1 parent e51f236 commit 462328c
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions docs/quick_start.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
---
sidebar_position: 1
---

# 快速入门


## 单表数据快速合成示例

```python
# 导入相关模块
from sdg.tabular.synthesizers import CTGAN
from sdg.tabular.data import get_single_table
from sdgx.tabular.synthesizers import CTGAN
from sdgx.tabular.data import get_single_table
import pandas as pd

# 读取数据
data = get_single_table()
```

真实数据如下:

```
age workclass fnlwgt ... hours-per-week native-country label
age workclass fnlwgt ... hours-per-week native-country class
0 27 Private 177119 ... 44 United-States <=50K
1 27 Private 216481 ... 40 United-States <=50K
2 25 Private 256263 ... 40 United-States <=50K
Expand All @@ -34,6 +34,7 @@ data = get_single_table()
[32561 rows x 15 columns]
```

```python
#定义模型
model = CTGAN()
Expand All @@ -46,8 +47,9 @@ sampled = model.generate(num_rows=10)
```

合成数据如下:

```
age workclass fnlwgt ... hours-per-week native-country label
age workclass fnlwgt ... hours-per-week native-country class
0 33 Private 276389 ... 41 United-States >50K
1 33 Self-emp-not-inc 296948 ... 54 United-States <=50K
2 67 Without-pay 266913 ... 51 Columbia <=50K
Expand All @@ -60,18 +62,18 @@ sampled = model.generate(num_rows=10)
9 28 State-gov 837932 ... 99 United-States <=50K
```


## 多表数据快速合成示例

```python
# 导入相关模块
from sdg.tabular.synthesizers import CWAMT
from sdg.tabular.data import get_multi_table
from sdgx.tabular.synthesizers import CWAMT
from sdgx.tabular.data import get_multi_table
import pandas as pd

# 读取数据
data = get_multi_table()
```

真实数据如下:

```
Expand Down Expand Up @@ -114,7 +116,9 @@ model.fit(data)
# 生成合成数据
sampled = model.generate(num_rows=10)
```

合成数据如下:

```
{'table1': {'table_name': 'train', 'table_value': Store DayOfWeek Date ... Promo StateHoliday SchoolHoliday
0 3 2 2013-01-01 ... 0 a 1
Expand Down Expand Up @@ -153,7 +157,6 @@ sampled = model.generate(num_rows=10)
[10 rows x 10 columns]}}
```


## API

除python组件之外,SDG还支持以Restful接口形式调用,具体接口参数请参考 [API文档](https://SDG.readthedocs.io/en/latest/api/index.html)

0 comments on commit 462328c

Please sign in to comment.