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

Passing invalid conditions when using constraints produces unreadable errors #511

Closed
fealho opened this issue Jul 12, 2021 · 0 comments · Fixed by #546
Closed

Passing invalid conditions when using constraints produces unreadable errors #511

fealho opened this issue Jul 12, 2021 · 0 comments · Fixed by #546
Assignees
Labels
feature request Request for a new feature
Milestone

Comments

@fealho
Copy link
Member

fealho commented Jul 12, 2021

Currently, using invalid conditions when using constraints produces unreadable errors. Instead, it would make more sense to validate the inputs and produce more meaningful error messages.

For example, if we use the UniqueCombination constraint and condition on the two constraint columns being different (which is an invalid condition) it produces a ValueError: No objects to concatenate, which doesn't provide much feedback about where the error is.

import pandas as pd
from sdv.constraints import *
from sdv.tabular import *

zero_to_nine = [i for i in range(10)]
data = pd.DataFrame({
    'a': zero_to_nine,
    'b': zero_to_nine,
    'c': zero_to_nine
})

constraint = UniqueCombinations(
    columns=['a', 'b'],
)

model = CTGAN(constraints=[constraint])
model.fit(data)
samples = model.sample(10, conditions={'a': 0, 'b': 1})
@fealho fealho added feature request Request for a new feature pending review labels Jul 12, 2021
@katxiao katxiao self-assigned this Aug 4, 2021
@csala csala added this to the 0.12.0 milestone Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants