Skip to content

RegexGenerator not generating unique values on consecutive reverse_transform calls #1091

Description

@frances-h

Environment Details

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

  • RDT version:
  • Python version:
  • Operating System:

Error Description

For RegexGenerator, consecutive reverse_transform calls can return already generated values even if cardinality_rule is set to unique. As long as randomization has not been reset, reverse_transform should always generate a new unique value, using appropriate fallbacks if the original generator has been exhausted.

Steps to reproduce

transformer = RegexGenerator(regex_format=r'\d', cardinality_rule='unique')
transformer.fit(pd.DataFrame(columns=['id']), 'id')
samples = pd.concat([transformer.reverse_transform(pd.DataFrame(index=[0])) for i in range(50)])['id']
assert samples.is_unique

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions