❖ SegmentSynthesizer
Last updated
Last updated
The SegmentSynthesizer calculates different segments of real data, and computes a different model for each one. You can supply any single-table synthesizer for computing the per-segment model. Use this when your real data is highly segmented, containing different patterns for each.
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.
enforce_min_max_values
: Control whether the synthetic data should adhere to the same min/max boundaries set by the real data
(default) True
The synthetic data will contain numerical values that are within the ranges of the real data.
False
enforce_rounding
: Control whether the synthetic data should have the same number of decimal digits as the real data
(default) True
The synthetic data will be rounded to the same number of decimal digits that were observed in the real data
False
The synthetic data may contain more decimal digits than were observed in the real data
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.
n_segments
: The number of segments to compute. The synthesizer automatically computes the segments based on the data patterns. In some cases, it may determine that the data requires less segmentation than specified, so n_segments
acts as the max.
(default) 5
Break up the real data into 5 segments
<int>
Break up the data into the provided number of segments
columns_for_segmentation
: A list of column names that should be used to compute the segments. The column names should be listed in the metadata, and contain statistical information (i.e. contain data that is numerical, datetime, categorical, or boolean).
(default) None
Use all the statistical column in the data to create segments
<list>
Use only the column names provided to create segements
per_segment_synthesizer
: A string with the type of synthesizer to use for modeling each individual segment
(default) 'GaussianCouplaSynthesizer'
Use the GaussianCopulaSynthesizer to model each segment.
<synthesizer_name>
per_segment_synthesizer_params
: A dictionary of parameters to use for each of the per segment synthesizers.
(default) None
Use the default parameters for the synthesizer
<dictionary>
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 parameter names and the values
The returned parameters are a copy. Changing them will not affect the synthesizer.
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 pandas DataFrame object containing the real data that the machine learning model will learn from
Output (None)
Technical Details: This synthesizer uses an algorithm to segment your real data into different groups. Each group may have different patterns. This synthesizer models each segment separately by calling upon other single-table synthesizers.
Since each segment is ultimately modeled separately, the overall fit time is expected to increase linearly with the number of segments.
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 SegmentSynthesizer 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 Customizations.
The synthetic data may contain numerical values that are less than or greater than the real data. Note that you can still set the limits on individual columns using .
For example [
,
]
.
For all options, see the .
Supply a synthesizer name from the list of . For example 'XGCSynthesizer'
or 'CTGANSynthesizer'
.
Update the default parameters for the synthesizer you've chosen by providing a dictionary of key/values pairs for each parameter. Refer to the docs for your synthesizer for possible parameters.
For example, for you can supply: {'default_distribution': 'norm'}
.
❖ SDV Enterprise bundle. This feature is available for purchase as an SDV Enterprise bundle. For more information, visit our page to .