* HSASynthesizer
Last updated
Last updated
The HSA Synthesizer uses a segment-based algorithm to learn from your real data and generate synthetic data. This synthesizer offers fast performance for unlimited tables.
When creating your synthesizer, you are required to pass in a Metadata object as the first argument.
All other parameters are optional. You can include them to customize the synthesizer.
locales
: A list of locale strings. Any PII columns will correspond to the locales that you provide.
(default) ['en_US']
Generate PII values in English corresponding to US-based concepts (eg. addresses, phone numbers, etc.)
<list>
Create data from the list of locales. Each locale string consists of a 2-character code for the language and 2-character code for the country, separated by an underscore.
For example [
"en_US"
,
"fr_CA"
]
.
For all options, see the Faker docs.
default_num_clusters
: The number of clusters to segment each table into
(default) 3
Split each table into 3 clusters for the purposes of capturing correlations between parent and child tables
<integer>
Split each table into the desired number of clusters. A smaller number of clusters makes the fit and sampling more efficient, and generally noises the data. A large number of clusters allows the model to learn more specific correlations across parent/child tables.
The HSA Synthesizer is a multi-table algorithm that models each individual table as well as the connections between them. You can get and set the parameters for each individual table.
Parameters
(required) table_name
: A string describing the name of the table
table_synthesizer
: The single table synthesizer to use for modeling the table
(default) 'GaussianCopulaSynthesizer'
: Use the GaussianCopulaSynthesizer to model the single table
Other available options: 'GaussianCopulaSynthesizer'
, 'CTGANSynthesizer'
, 'TVAESynthesizer'
, 'CopulaGANSynthesizer'
. For more information, see Single Table Synthesizers.
table_parameters
: A dictionary mapping the name of the parameter (string) to the value of the parameter (various). These parameters are different for each synthesizer. For more information, see Single Table Synthesizers.
Output (None)
Use this function to access the all parameters your synthesizer uses -- those you have provided as well as the default ones.
Parameters (None)
Output A dictionary with the table names and parameters for each table.
These parameters are only for the multi-table synthesizer. To get individual table-level parameters, use the get_table_parameters
function.
The returned parameters are a copy. Changing them will not affect the synthesizer.
Use this function to access the all parameters a table synthesizer uses -- those you have provided as well as the default ones.
Parameters
(required) table_name
: A string describing the name of the table
Output A dictionary with the parameter names and the values
Use this function to access the metadata object that you have included for the synthesizer
Parameters None
Output A Metadata object
The returned metadata is a copy. Changing it will not affect the synthesizer.
To learn a machine learning model based on your real data, use the fit
method.
Parameters
(required) data
: A dictionary mapping each table name to a pandas DataFrame containing the real data that the machine learning model will learn from
Output (None)
Technical Details: HSA, which stands for Hierarchical Segmentation Algorithm, uses a segment-based approach to model the parent-child relationships of a multi-table datasets. At a base level, it can model individual tables using any single table synthesizer.
After fitting this synthesizer, you can access the marginal distributions that were learned to estimate the shape of each column.
Parameters
(required) table_name
: A string with the name of the table
Output A dictionary that maps the name of each learned column to the distribution that estimates its shape
For more information about the distributions and their parameters, visit the Copulas library.
Learned parameters are only available for parametric models and distributions. For eg. you will not be able to access learned distributions for GAN-based synthesizers (such as CTGAN) or the 'gaussian_kde'
technique.
In some cases, the synthesizer may not be able to fit the exact distribution shape you requested, so you may see another distribution shape (eg. 'truncnorm'
instead of 'beta'
).
After fitting, you can access the loss values computed during each epoch for both the numerator and denominator.
Parameters
(required) table_name
: A string with the name of the table
Output A pandas.DataFrame object containing epoch number, generator loss value and discriminator loss value.
Loss values are only available for tables that use neural network-based models. such as CTGAN, TVAE or CopulaGAN.
Save your trained synthesizer for future use.
Use this function to save your trained synthesizer as a Python pickle file.
Parameters
(required) filepath
: A string describing the filepath where you want to save your synthesizer. Make sure this ends in .pkl
Output (None) The file will be saved at the desired location
Use this function to load a trained synthesizer from a Python pickle file
Parameters
(required) filepath
: A string describing the filepath of your saved synthesizer
Output Your synthesizer, as a HMASynthesizer object
After training your synthesizer, you can now sample synthetic data. See the Sampling section for more details.
Want to improve your synthesizer? Input logical rules in the form of constraints, and customize the transformations used for pre- and post-processing the data.
For more details, see Advanced Features.
*SDV Enterprise Feature. This feature is only available for licensed, enterprise users. For more information, visit our page to .