Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update document #18

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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