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

GreaterThan constraint's transform strategy fails on columns that are not float #448

Closed
amontanez24 opened this issue May 26, 2021 · 0 comments · Fixed by #476
Closed

GreaterThan constraint's transform strategy fails on columns that are not float #448

amontanez24 opened this issue May 26, 2021 · 0 comments · Fixed by #476
Assignees
Labels
bug Something isn't working
Milestone

Comments

@amontanez24
Copy link
Contributor

Environment Details

Please indicate the following details about the environment in which you found the bug:

  • SDV version: 0.10.0
  • Python version: 3.x
  • Operating System: Windows, MacOS

Error Description

Related to #421

When a GreaterThan constraint is provided transform as the handling_strategy, it will fail if the high column is not a float. This is because the HyperTransformer reverse transforms the columns before the constraint's reverse transformation takes place. If the high column was initially an int or datetime, it gets transformed by the HyperTransformer. The constraint then has a value in the wrong form when attempting to apply its reverse transformation.

Steps to reproduce

from sdv.demo import load_tabular_demo
from sdv.constraints import UniqueCombinations
from sdv.tabular import GaussianCopula
from sdv.constraints import GreaterThan

employees = load_tabular_demo()

age_gt_age_when_joined_constraint = GreaterThan(
    low='age_when_joined',
    high='age',
    handling_strategy='transform'
)
constraints = [
    age_gt_age_when_joined_constraint
]

gc = GaussianCopula(constraints=constraints)
gc.fit(employees)

sampled = gc.sample(10, conditions={'age': 40})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants