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

Create sample_remaining_columns() method #692

Closed
npatki opened this issue Jan 27, 2022 · 0 comments · Fixed by #708
Closed

Create sample_remaining_columns() method #692

npatki opened this issue Jan 27, 2022 · 0 comments · Fixed by #708
Assignees
Labels
data:single-table Related to tabular datasets feature request Request for a new feature
Milestone

Comments

@npatki
Copy link
Contributor

npatki commented Jan 27, 2022

Problem Description

Let's make sampling more user friendly. We can create multiple methods for different user needs.

A new sample_remaining_columns() method can address conditional sampling with a given Dataframe.

Expected behavior

Parameters:

  • (required) known_columns: A pandas.DataFrame with the columns that are already known -- this specifies number of rows
  • max_tries: renamed from existing max_retries param (default: 100)
  • batch_size_per_try: Number of rows to sample per try (default: 10x requested num)
  • randomize_samples will determine whether or not there should be a fixed seed (default: True)
>>> model.sample_remaining_columns(known_columns=my_dataframe)

Error Handling

Running out of tries

# Always gracefully reject sample (ie return any rows that are sampled)
>>> synthetic_data = model.sample_remaining_columns(known_columns=my_dataframe)
Warning: Only able to sample 75 of the requested rows. To sample more rows, try increasing max_tries
(currently: 100) or increasing batch_size_per_try (currently: 10000). Note that increasing these values will also
increase the sampling time.

# Error if we weren't able to sample any rows
>>> synthetic_data = model.sample_remaining_columns(known_columns=my_dataframe)
Error: Unable to sample any rows for the given conditions. Try increasing max_tries
(currently: 100) or increasing batch_size_per_try (currently: 10000). Note that increasing these values will also
increase the sampling time.

Checking for invalid input

# Unexpected column name
>>> synthetic_data = model.sample_remaining_columns(known_columns=invalid_dataframe)
Error: Unexpected column name 'New_Column'. Use a column name that was present in the original data.
 
# Unexpected categorical column value
>>> synthetic_data = model.sample_remaining_columns(known_columns=invalid_dataframe_2)
Error: Unexpected value 'NEW_VALUE' in column 'New_Column'. Use a value that was present in the original data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:single-table Related to tabular datasets feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants