-
Notifications
You must be signed in to change notification settings - Fork 321
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
Validate constraint parameters in add_constraints
#1233
Conversation
Codecov ReportBase: 95.66% // Head: 95.68% // Increases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## V1.0.0.dev #1233 +/- ##
==============================================
+ Coverage 95.66% 95.68% +0.02%
==============================================
Files 47 47
Lines 3618 3637 +19
==============================================
+ Hits 3461 3480 +19
Misses 157 157
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
add_constraintss
add_constraints
sdv/multi_table/base.py
Outdated
params = {'constraint_class', 'constraint_parameters', 'table_name'} | ||
keys = constraint_dict.keys() | ||
missing_params = params - keys | ||
if missing_params: | ||
raise SynthesizerInputError( | ||
f'A constraint is missing required parameters {missing_params}. ' | ||
'Please add these parameters to your constraint definition.' | ||
) | ||
|
||
extra_params = keys - params | ||
if extra_params: | ||
raise SynthesizerInputError( | ||
f'Unrecognized constraint parameter {extra_params}. ' | ||
'Please remove these parameters from your constraint definition.' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like we are doing this twice, I think we can just check if table_name
is not in constraint_dict
raise the error stating that you are missing table_name
, if not then the data processor will raise the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I did it like that so the errors would show up together (if you don't pass any parameters, it will crash saying only table_name
is missing, and only after you add table_name
will it tell you the other errors).
But I think your way is better, it's too much duplicated code otherwise.
@amontanez24 @npatki Note that these errors are not being aggregated with the other constraint errors ( This seems to be what the issue was describing, but I wanted to double check this is indeed the intended approach. |
The aggregated constraints errors are thrown when are doing fit right? Ie they happen in the middle of execution when trying to model the constraint. This issue is just when specifying the constraint before any sort of processing or fitting happens. |
@npatki They are thrown in the SDV/sdv/data_processing/data_processor.py Lines 233 to 254 in 5f586ec
|
@fealho oh got it! In any case, I think the answer remains the same: We want to throw the errors described in this issue first. And then if that all passes, we can then do additional validation and throw an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve #1210.