-
Notifications
You must be signed in to change notification settings - Fork 366
Allow is_valid
to be called on unfit constraints
#2578
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
Conversation
is_valid
to be called on unfit constraints
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2578 +/- ##
==========================================
- Coverage 98.14% 98.14% -0.01%
==========================================
Files 70 70
Lines 7212 7210 -2
==========================================
- Hits 7078 7076 -2
Misses 134 134
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5419bac
to
0f69f2c
Compare
ae7076c
to
5e2f85e
Compare
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.
One suggestion but looks good!
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.
Looks good!
|
||
is_valid = self.programmable_constraint.is_valid(data) | ||
|
||
if self._is_single_table: | ||
return {self._table_name: is_valid} | ||
return {table_name: is_valid} |
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.
Here, should we update the if condition to be the same as in the base cag class:
if isinstance(data, pd.DataFrame) or self._single_table:
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.
No, this is a different check - the _is_single_table
attribute on the harness controls whether we expect a single dataframe or a dataframe dict from the programmable constraint (based on whether it's a SingleTableProgrammableConstraint
or a ProgrammableConstraint
).
@@ -99,6 +99,7 @@ def __init__(self, column_names, table_name): | |||
self.table_name = table_name | |||
self._joint_column = '#'.join(self.column_names) | |||
self._combinations = None | |||
self._fitted = False |
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.
Why do we need this?
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.
We need it so we can use the FixedCombinations
methods on this class. The _is_valid
method for FixedCombinations
now checks whether or not the constraint has been fit, so we need it set on this class for the method to actually work without erroring.
44908a6
to
441d115
Compare
CU-86b586xqm
Adds metadata as an optional parameter to
is_valid
(and a required parameter to the constraint method_is_valid
) so that the method can be called on an unfit constraint when running DayZ.