You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am explicitly trying to turn off rounding for a column, but if I set up FloatFormatter with learn_rounding_scheme=False, I see that this doesn't have any effect.
Steps to reproduce
fromsdv.datasets.demoimportdownload_demofromsdv.single_tableimportGaussianCopulaSynthesizerfromrdt.transformers.numericalimportFloatFormatterdata, metadata=download_demo(
modality='single_table',
dataset_name='fake_hotel_guests'
)
synthesizer=GaussianCopulaSynthesizer(metadata)
synthesizer.auto_assign_transformers(data)
synthesizer.update_transformers({
'amenities_fee': FloatFormatter(learn_rounding_scheme=False) # I'm trying to turn off rounding for this column
})
synthesizer.fit(data)
synthesizer.sample(5)
Expected Results
The code itself is actually working as intended -- because the rounding is being enforced at a synthesizer level, it's not possible to override it by just updating a transformer. In this case, I expect a warning should be thrown after update_transformers.
Warning: Unable to turn off rounding scheme for column 'amenities_fee', because the overall synthesizer is
enforcing rounding. We recommend setting the synthesizer's 'enforce_rounding' parameter to False.
Note that this warning should only appear if:
The synthesizer's enforce_rounding is set to True (this is also the default) AND
The user is providing a transformer with learn_rounding_scheme=False (they are trying to turn it off)
Additional Context
Note that the behavior is fine the other way around -- i.e. if the synthesizer's enforce_rounding=False, I am still able to turn on rounding for individual columns with using the FloatFormatter. So in this particular case, I could do this instead:
# at synthesizer level, do not enforce rounding for any of the columnssynthesizer=GaussianCopulaSynthesizer(metadata, enforce_rounding=False)
# now, you can selectively turn rounding back ON for any columns you needsynthesizer.update_transformers({
'room_rate': FloatFormatter(learn_rounding_scheme=True)
})
synthesizer.fit(data)
synthesizer.sample(5)
The text was updated successfully, but these errors were encountered:
Environment Details
Error Description
I am explicitly trying to turn off rounding for a column, but if I set up
FloatFormatter
withlearn_rounding_scheme=False
, I see that this doesn't have any effect.Steps to reproduce
Expected Results
The code itself is actually working as intended -- because the rounding is being enforced at a synthesizer level, it's not possible to override it by just updating a transformer. In this case, I expect a warning should be thrown after
update_transformers
.Note that this warning should only appear if:
enforce_rounding
is set to True (this is also the default) ANDlearn_rounding_scheme=False
(they are trying to turn it off)Additional Context
Note that the behavior is fine the other way around -- i.e. if the synthesizer's
enforce_rounding=False
, I am still able to turn on rounding for individual columns with using theFloatFormatter
. So in this particular case, I could do this instead:The text was updated successfully, but these errors were encountered: