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

Synthesizers don't validate constraints during validate() #1402

Closed
amontanez24 opened this issue Apr 28, 2023 · 0 comments · Fixed by #1429
Closed

Synthesizers don't validate constraints during validate() #1402

amontanez24 opened this issue Apr 28, 2023 · 0 comments · Fixed by #1429
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.*
  • Python version: Any
  • Operating System: Any

Error Description

When running synthesizer.validate(data) on data that doesn't meet constraints already set in the synthesizer, we should raise errors for those constraints.

Steps to reproduce

from sdv.datasets.demo import download_demo

real_data, metadata = download_demo(
    modality='single_table',
    dataset_name='fake_hotel_guests'
)
real_data['checkin_date'][0] = real_data['checkout_date'][1] # make constraint fail
from sdv.single_table import GaussianCopulaSynthesizer

gc = GaussianCopulaSynthesizer(metadata)

checkin_lessthan_checkout = {
    'constraint_class': 'Inequality',
    'constraint_parameters': {
        'low_column_name': 'checkin_date',
        'high_column_name': 'checkout_date'
    }
}
gc.add_constraints([
    checkin_lessthan_checkout
])
gc.validate() # Should raise error for constraint
@amontanez24 amontanez24 added the bug Something isn't working label Apr 28, 2023
@amontanez24 amontanez24 added this to the 1.2.0 milestone Jun 6, 2023
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.

2 participants