Implementation:Sdv dev SDV FixedCombinations Init
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Data_Quality, Constraint_Satisfaction |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
Concrete tool for enforcing fixed value combinations across columns in synthetic data, provided by the SDV library.
Description
The FixedCombinations constraint ensures only value tuples seen during training appear in synthetic output. It requires at least two columns and works with categorical or boolean columns.
Usage
Create a FixedCombinations instance with the list of column names and add it to a synthesizer.
Code Reference
Source Location
- Repository: SDV
- File: sdv/cag/fixed_combinations.py
- Lines: L21-56
Signature
class FixedCombinations(BaseConstraint):
def __init__(self, column_names, table_name=None):
"""
Args:
column_names (list[str]): Columns that must maintain fixed combinations.
Must contain at least two columns.
table_name (str or None): Target table (multi-table). Defaults to None.
"""
Import
from sdv.cag import FixedCombinations
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| column_names | list[str] | Yes | List of columns (minimum 2) with fixed valid combinations |
| table_name | str or None | No | Target table for multi-table data |
Outputs
| Name | Type | Description |
|---|---|---|
| instance | FixedCombinations | Constraint object ready to add to a synthesizer |
Usage Examples
from sdv.cag import FixedCombinations
constraint = FixedCombinations(column_names=['country', 'city'])
synthesizer.add_constraints([constraint])
synthesizer.fit(data)
synthetic_data = synthesizer.sample(num_rows=1000)
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment