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

Unable to sample conditionally in Tabular_Preset model #796

Closed
bhaveshneekhra opened this issue May 14, 2022 · 1 comment · Fixed by #802
Closed

Unable to sample conditionally in Tabular_Preset model #796

bhaveshneekhra opened this issue May 14, 2022 · 1 comment · Fixed by #802
Assignees
Labels
bug Something isn't working
Milestone

Comments

@bhaveshneekhra
Copy link

Environment Details

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

  • SDV version: 0.14.1
  • Python version: 3.8.10
  • Operating System: Ubuntu 20.04.3

Error Description

I am just reproducing this code at https://sdv.dev/SDV/user_guides/single_table/tabular_preset.html#conditional-sampling.

Steps to reproduce

Just run everything on the page till https://sdv.dev/SDV/user_guides/single_table/tabular_preset.html#conditional-sampling

If there was a crash, please include the traceback here.

TypeError Traceback (most recent call last)
in
----> 1 model.sample_conditions(conditions = all_conditions)

~/.local/lib/python3.8/site-packages/sdv/lite/tabular.py in sample_conditions(self, conditions, max_tries, batch_size_per_try, randomize_samples, output_file_path)
196 Sampled data.
197 """
--> 198 sampled = self._model.sample_conditions(
199 conditions, max_tries, batch_size_per_try, randomize_samples, output_file_path)
200

TypeError: sample_conditions() takes from 2 to 5 positional arguments but 6 were given

@bhaveshneekhra bhaveshneekhra added bug Something isn't working pending review labels May 14, 2022
@npatki
Copy link
Contributor

npatki commented May 14, 2022

Hi @bhaveshneekhra -- thanks for filing. We'll look into this.

Did you also follow the step to save and reload the model? I observed that it works fine if you do this, but it crashes if you skip this part.

I'd suggest saving and re-loading as a temporary workaround.

model.save('fast_ml_model.pkl')
model = TabularPreset.load('fast_ml_model.pkl')

conditioned_data = model.sample_conditions(conditions=all_conditions)

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
Development

Successfully merging a pull request may close this issue.

4 participants