For the complete documentation index, see llms.txt. This page is also available as Markdown.

* DayZSynthesizer

*SDV Enterprise Feature. This feature is only available for licensed, enterprise users. For more information, visit our page to Compare SDV Features.

The Day Z Synthesizer produces synthetic data from scratch using the metadata. This allows you start generating synthetic data from day zero: no machine learning required!

from sdv.multi_table import DayZSynthesizer

synthesizer = DayZSynthesizer(metadata)
synthetic_data = synthesizer.sample_scale(scale=1.0)

Creating a synthesizer

When creating your synthesizer, you are required to pass in a Metadata object as the first argument. We also recommend setting the parameters at this time.

synthesizer = DayZSynthesizer(
    metadata,
    locales=['en_US', 'en_CA', 'fr_CA']
)

Parameter Reference

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.

Programmatic Parameters API

For even more realism, use the API below to set some additional parameters.

set_missing_values

Use this method to set the proportion of missing values to generate in a column

Parameters

  • (required) table_name: A string representing the name of the table

  • (required) column_name: A string representing the name of the column. This column cannot be a primary or foreign key.

  • (required) missing_values_proportion: A float representing the proportion of missing values

    • Any float between 0.0 and 1.0: Randomly create this proportion of missing values in the column

Output (None) Sets the proportion of the missing values

set_cardinality

Use this function to set the cardinality of a parent/child relationship. The cardinality refers to the number of children that each parent row is allowed to have. This can be anywhere from 0 to infinity.

This function can help you create realistic data for many relationship types such as 1-1, 1-to-many, etc.

Parameters

  • (required) parent_table_name: The name of the parent table

  • (required) child_table_name: The name of the child table

  • (required) parent_primary_key: The name of the primary key in the parent

  • (required) child_foreign_key: The name of the foreign key in the child that refers to the primary key of the parent

  • min_cardinality: The minimum # of children each parent must have, must be an integer >=0

    • (default) 0: A parent row must have 0 or more children

    • <integer>: An integer representing the minimum # of children

  • max_cardinality: The maximum # of children each parent must have, must be an integer >0

    • (default) None: Do not enforce a maximum (i.e. the maximum # of children can be infinite)

    • <integer>: An integer > min_cardinality representing the maximum # of children

    • Note that If min cardinality = max cardinality, then that means there is a fixed # of children for each parent.

Output (None) Sets the min and max cardinality of the parent/child relationship, or updates it if the cardinality was already set.

set_table_sizes

Use this function to set the (relative) table sizes of each table in the dataset. When sampling, you can scale the entire dataset up or down.

Parameters:

  • (required) num_rows_per_table: A dictionary containing the number of rows to set per table. The keys are the names of the tables, and the values are integers representing the number of rows.

get_parameters

Use this function to access the all parameters your synthesizer uses -- those you have provided as well as the default ones.

Parameters

  • output_filepath: A string representing the name of the file to write the parameters to. We recommend storing this as a JSON file. Defaults to None, meaning that no output filepath is written.

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.

get_table_parameters

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

Saving your synthesizer

Save your synthesizer for future use

save

Use this function to save your 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

load (utility function)

Use this utility function to load a trained synthesizer from a Python pickle file. After loading your synthesizer, you'll be able to sample synthetic data from it.

Parameters

  • (required) filepath: A string describing the filepath of your saved synthesizer

Output Your synthesizer object

This utility function works for any SDV synthesizer.

What's next?

After training your synthesizer, you can now sample synthetic data. See the Sampling section for more details. (This synthesizer does not yet offer support for conditional sampling.)

Want to improve your synthesizer? Input logical rules in the form of constraints and customize the transformations used for preprocessing the data.

Last updated