-
Notifications
You must be signed in to change notification settings - Fork 320
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
Support passing tabular constraints to the HMA1 model #296
Comments
Thanks for reporting this @myrthewouters There seems to a problem in how the GaussianCopula models capture the arguments inside HMA1. I suspect that you should be able to work around this if you dump the If you want to explore it, try creating a Table instance with constraints in it and then calling its |
Changing a bit the issue title and its type to reflect that this is a new feature that still needs to be implemented. |
Some more details about the workaround described in the prior comment (@csala please correct if this is wrong) Create your own multi-table metadata json file that includes constraints. Rough outline:
data = None # TODO load single table data
constraints = [] # TODO create all the constraints
model = GaussianCopula(constraints=constraints)
model.fit(data)
print(model.get_metadata())
I understand this is a very manual workaround, and not a desired end-state. We should keep this bug open to track a proper fix. |
Hi @npatki , employees = load_tabular_demo() age_gt_age_when_joined_constraint = GreaterThan(low='age_when_joined',high='age',handling_strategy='reject_sampling') constraints = [age_gt_age_when_joined_constraint] gc = GaussianCopula(constraints=constraints) gc.fit(employees) gc.get_metadata() ################# gc1 = GaussianCopula() gc1.fit(employees) gc1.get_metadata()` can you please provide a example metadata with constraints added. Thankyou. |
@kvrameshreddy from sdv import Metadata
from sdv.relational import HMA1
metadata = Metadata()
metadata.add_table(
name='YOUR_TABLE_NAME',
....
)
constraints = [
.....
]
# Add the following line to hack it !!!
metadata._metadata['tables']['YOUR_TABLE_NAME']['constraints'] = constraints
model = HMA1(metadata) The problem with function get_metadata() is that it doesn't print the constraints. |
Hi @tim5go, Thanks for the reply. You are absolutely correct. |
Environment Details
Error Description
Hi,
I am running the HMA1 model on my dataset. The data consists of two tables. I am trying to add constraints to the HMA1 model that ensure the sampled values of some columns are positive. However, I get an error when adding the constraints as model kwargs.
Steps to reproduce
My dataset is private, so I reproduced the issue with your relational demo dataset with the code below.
Error:
The text was updated successfully, but these errors were encountered: