Skip to content

Commit

Permalink
Merge pull request #18 from hitsz-ids/document-readme
Browse files Browse the repository at this point in the history
Update document
  • Loading branch information
MooooCat committed Aug 30, 2023
2 parents debdace + bbcd344 commit a0fc66c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ pip install sdgx

```python
# 导入相关模块
from sdgx.utils.io.csv_utils import *
from sdgx.models.single_table.ctgan import GeneratorCTGAN
from sdgx.transform.transformer import DataTransformerCTGAN
from sdgx.models.single_table.ctgan import CTGAN
from sdgx.transform.sampler import DataSamplerCTGAN
from sdgx.transform.transformer import DataTransformerCTGAN
from sdgx.utils.io.csv_utils import *

# 读取数据
demo_data, discrete_cols = get_demo_single_table()
Expand Down
23 changes: 13 additions & 10 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@

```python
# 导入相关模块
from sdgx.tabular.synthesizers import CTGAN
from sdgx.tabular.data import get_single_table
import pandas as pd
from sdgx.models.single_table.ctgan import CTGAN
from sdgx.transform.sampler import DataSamplerCTGAN
from sdgx.transform.transformer import DataTransformerCTGAN
from sdgx.utils.io.csv_utils import *

# 读取数据
data = get_single_table()
demo_data, discrete_cols = get_demo_single_table()

```

真实数据如下:
Expand All @@ -38,13 +40,15 @@ data = get_single_table()

```python
#定义模型
model = CTGAN()
model = GeneratorCTGAN(epochs=10,\
transformer= DataTransformerCTGAN,\
sampler=DataSamplerCTGAN)

#训练模型
model.fit(data)
model.fit(demo_data, discrete_cols)

# 生成合成数据
sampled = model.generate(num_rows=10)
sampled_data = model.sample(1000)
```

合成数据如下:
Expand All @@ -67,9 +71,8 @@ sampled = model.generate(num_rows=10)

```python
# 导入相关模块
from sdgx.tabular.synthesizers import CWAMT
from sdgx.tabular.data import get_multi_table
import pandas as pd
from sdgx.models.single_table.cwamt import CWAMT
from sdgx.utils.io.csv_utils import *

# 读取数据
data = get_multi_table()
Expand Down

0 comments on commit a0fc66c

Please sign in to comment.