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

Add FixedCombinations CAG pattern + add CAG base class to public #2383

Open
frances-h opened this issue Feb 25, 2025 · 0 comments
Open

Add FixedCombinations CAG pattern + add CAG base class to public #2383

frances-h opened this issue Feb 25, 2025 · 0 comments
Labels
feature request Request for a new feature

Comments

@frances-h
Copy link
Contributor

Problem Description

As we've built up our multi-table CAG patterns, we'd like to convert our each of our existing single table constraints to use the new CAG framework.

Expected behavior

CAG Base Class

This CAG should inherit from the CAG base class which can be brought over from enterprise (excluding the fix_dayz_data method). We should also add the is_valid method to the CAG base class:
is_valid(self, data)

  • Check that the pattern is fitted, else raise a NotFittedError.
  • Call the self._is_valid(data) method, which should be defined in the base class to raise a NotImplemented error

Add the FixedCombinations CAG pattern.

This CAG should copy the functionality of the existing constraint, much of _fit, _transform, and _reverse_transform should be able to be directly copied without significant logical rewrites.

Args
column_names (list[str]): Same as FixedCombinations.
table_name (str, optional): The name of the table to apply the CAG pattern to.

Expected Functionality

_validate_pattern_with_metadata

  • If no table_name is provided, the metadata must only contain a single table (this should be considered the target table)
  • Validate that all columns in column_names exist in the metadata.
  • Validate that all columns in column_names have either the boolean or categorical sdtype
  • Validate that no column in column_names are part of a column relationship.

_validate_pattern_with_data

  • No data validation needed

_get_updated_metadata

  • Add a joint combination column (by default can be the column names joined with #, as in the constraint)
  • Drop all column_names from the metadata.

_fit

  • Same logic as the constraint

_is_valid

  • Same logic as the constraint

_transform

  • Same logic as the constraint

_reverse_transform

  • Same logic as the constraint

Additional context

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

No branches or pull requests

1 participant