❖ MultiSelectQuestion
❖ Sandbox Constraint. This constraint is still in an experimental state. We are still collecting feedback about whether it works accurately and meets the desired goals. The API parameters and functionality may change as we improve the constraint.
Sandbox constraints are available to SDV Enterprise customers who have purchased the CAG Bundle, an optional add-on to SDV Enterprise. For more information, please visit the CAG Bundle page.
Use the MultiSelectQuestion constraint when you have survey data that records the responses to a multi-select question. This constraint expects that your exported data contains one column per multi-select option.

Q18) is a multi-select question. Each option corresponds to a different column. For example Q18_1 denotes whether the responser selected the first option; Q18_2 denotes whether they selected the second option; and so on.This constraint is designed to emulate survey responses for a multi-select question. Configure it with the same options as your survey in order to see high quality synthetic data. Configuration options include:
Max number of options allowed, for example if you are asking survey responders to "select up to 3 choices" based on their preferences. Each response should only contain up to the max number of allowable options selected.
An exclusive option, such as "none of the above" or "other". When selected, all of the other options are unselected.
Constraint API
Create a MultiSelectQuestion constraint.
Parameters:
(required)
column_names: A list of strings that describe all the columns corresponding to the multi-select question. Each column should represent a different possible option to the multi-select question. The sdtype of these columns should be numerical, categorical, or boolean.table_name: The name of the table that contains the columns. This is required if you have multi-table data.max_num_selected: An integer > 0 representing the maximum number of options that a responder is allowed to select.(default)
None: There is no maximum, meaning that it is possible for responders to select all of the options (except the exclusive column, if one exists).
exclusive_column_name: A string with the name of the column that represents the exclusive option, such as "none of the above" or "other". If the exclusive option is selected, than all the other options are unselected.(default)
None: There is no exclusive column for this multi-select question.
Make sure that all the tables and columns you provide are in your Metadata.
Usage
Apply the constraint to any SDV synthesizer. Then fit and sample as usual.
For more information about using predefined constraints, please see the Constraint-Augmented Generation tutorial.
FAQs
What kind of data is compatible with the constraint?
This constraint expects that your exported data contains one column per multi-select option. This constraint is able to automatically parse many different types of multi-select response encodings. Below are some examples of the different types of encodings.
Binary indicator
1 or True
0 or False
Sparse indicators
1
null
Label export
Label of the choice (eg. "chocolate", "vanilla", ...)
null
Recode values
Different numerical code per column (eg. 1, 2, ...)
null
Three-state encoding
1, label, or recode value
0 for explicitly unselected
null for skipped
This is why the sdtypes of your columns may vary between categorical, boolean, or numerical. All of the options that correspond to the survey question should have the same type of encoding and the same sdtype.
When should I add a MultiSelectQuestion constraint?
This constraint is explicitly designed to create realistic synthetic data for multi choice questions with configuration options such as the max number of selections and exclusive options.
If you do not have any of these configurations in your multi-select question, then there is no need to add the constraint. But adding the constraint anyway should not adversely affect your synthetic data quality.
How does this constraint handle unselected and skipped options?
This constraint learns which values correspond to selected options, unselected options, and skipped options. In many cases unselected and skipped options are encoded the same way, with a NaN or None value. However, a 3-state encoding might make a distinction. For example, if an option is shown to the respondent but not selected by them, it is marked as a 0; if it is not shown at all, then it is marked as a NaN.
This constraint currently allows skipping the entire question but not skipping particular options.
In case of confusion, you can override the selected and unselected values that should be used for each column. Provide a dictionary that maps each column name to the selected or unselected value.
Last updated