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

Duplicate IDs when using reject-sampling #331

Closed
csala opened this issue Mar 3, 2021 · 0 comments · Fixed by #382
Closed

Duplicate IDs when using reject-sampling #331

csala opened this issue Mar 3, 2021 · 0 comments · Fixed by #382
Assignees
Labels
bug Something isn't working
Milestone

Comments

@csala
Copy link
Contributor

csala commented Mar 3, 2021

Environment Details

Please indicate the following details about the environment in which you found the bug:

  • SDV version: 0.8.0
  • Python version: any
  • Operating System: any

Error Description

When a tabular sampling call involves reject-sampling, the ids are reset at each re-sampling call, potentially producing duplicate ids.

Steps to reproduce

In [1]: import sdv

In [2]: users = sdv.demo.load_demo()['users']

In [3]: model = sdv.tabular.CTGAN(primary_key='user_id', epochs=10)

In [4]: model.fit(users)

In [5]: model.sample(10, conditions={'gender': 'M'})
Out[5]: 
   user_id country gender  age
0        0      FR      M   19
1        4      FR      M   69
2        5      US      M   66
3        8      ES      M   62
4        9      DE      M   54
5        2      BG      M   44
6        3      ES      M   64
7        5      DE      M   61
8        1      US      M   52
9        1      US      M   65

Steps to fix

To fix this, any id fields should be re-populated after all the rows have been successfully sampled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants