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

Alternate keys not unique when assigned to a semantic type #1111

Closed
amontanez24 opened this issue Nov 21, 2022 · 0 comments
Closed

Alternate keys not unique when assigned to a semantic type #1111

amontanez24 opened this issue Nov 21, 2022 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@amontanez24
Copy link
Contributor

Environment Details

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

  • SDV version: 1.0.0.dev
  • Python version: any
  • Operating System: any

Error Description

If a column is marked as an alternate key in the metadata, and also assigned to a semantic type, then the sampled values are not guaranteed to be unique. Alternate keys must always be unique. We should treat them similarly to primary keys.

Steps to reproduce

test_data = pd.DataFrame(data={
    'alternate_key': ['Discover', 'Maestro', 'VISA 19 digit'],
    'numerical_col': [1, 2, 3],
})

test_metadata = SingleTableMetadata()
test_metadata.detect_from_dataframe(test_data)
test_metadata.update_column(
    column_name='alternate_key',
    sdtype='credit_card_provider',
    pii=True
)
test_metadata.add_alternate_keys(column_names=['alternate_key'])
synthesizer = GaussianCopulaSynthesizer(test_metadata)
synthesizer.fit(test_data)
synthesizer.sample(5)
@amontanez24 amontanez24 added the bug Something isn't working label Nov 21, 2022
@amontanez24 amontanez24 added this to the 1.0.0 milestone Nov 21, 2022
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

No branches or pull requests

2 participants