❖ Range Extrapolation
❖ SDV Enterprise Bundle. This feature is available as part of the Targeted Sampling bundle, an optional add-on to SDV Enterprise. For more information, please visit the Targeted Sampling page.
By default, your synthesizers learns the patterns based on the training data you provide, including the possible ranges within each column. The range extrapolation feature allows you to create synthetic data that is outside the ranges of your training data.
Usage
This feature is meant for extrapolating outside of the ranges that your training data contains. This covers:
Extrapolating the possible min and max for continuous attributes like numerical or datetime columns
Creating brand new category values that were not present in your original training data
Allowing null (or non-null) values in a column even when your training data doesn't have this scenario covered
Specify Your Ranges
To get started, we recommend creating a JSON file that contains the ranges of the columns. You do not need to specify all columns, just the ones that need extrapolation.
The JSON should comprise of a dictionary called "tables". Inside of it, each table name should map to another dictionary of columns.
{
"tables": {
"users": {
"age": {
"min": 0,
"max": 100,
"missing_values_allowed": false
},
"tax_status": {
"categories": ["Single", "Married Filing Jointly", ... ],
"missing_values_allowed": true
}
...For each column, specify the name of the column and map to the range information for that column. The range information can be found below.
If your column is numerical specify:
"min": The min allowable value for the column."max": The max allowable value for the column."missing_values_allowed": A boolean describing whether missing values are allowed.
If any of these keys are not provided, then the synthesizer will learn this information from the data.
If your column is a datetime specify:
"min": The min allowable value for the column. This should be represented in the same datetime format as your data."max": The max allowable value for the column. This should be represented in the same datetime format as your data."missing_values_allowed": A boolean describing whether missing values are allowed.
If any of these keys are not provided, then the synthesizer will learn this information from the data.
If your column is categorical specify:
"categories": A list of strings describing all the allowed category values."missing_values_allowed": A boolean describing whether missing values are allowed.
If any of these keys are not provided, then the synthesizer will learn this information from the data.
For any other column specify:
"missing_values_allowed": A boolean describing whether missing values are allowed.
Please note missing values are not allowed for primary key columns.
We recommend saving this as a JSON file. You can then read the JSON file as a Python dictionary using the command below.
<synthesizer>.add_ranges
Use this function to add ranges to your synthesizer before fitting the data. This function can be applied to any single- or multi-table synthesizer that you have access to.
Parameters:
(required)
range_info: A dictionary that describes the extrapolated ranges that the columns in your data should have. Not all tables or columns have to be present in this dictionary, only the ones that need range extrapolation. See the section above for more details.
Output: (None) The synthesizer will now be able to extrapolate outside of the ranges that are present in the training data during fit.
What's Next?
Be sure to fit your syntheizer for the extrapolation to work.
After fitting, you can sample synthetic data as usual. The synthetic data will now contain the full ranges that you specified in your dictionary as opposed to the ranges from the training data.
Note that you may need to sample many data points in order to see the extrapolated values. Alternatively, you can request the extrapolated values explicitly. For example, say your training data only included users aged 25-60 but your range extrapolation extends the ranges from 18-100. You can then request synthesizing any age between 18 and 100.
For more information, see the API docs for conditional sampling.
Last updated