Implementation:Sdv dev SDV HMASynthesizer Init
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Synthetic_Data, Relational_Data |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
Concrete tool for creating an HMA-based multi-table synthesizer that preserves relational structure, provided by the SDV library.
Description
The HMASynthesizer implements the Hierarchical Modeling Algorithm. It creates per-table GaussianCopulaSynthesizer instances, manages table augmentation with child statistics, and coordinates hierarchical sampling.
Usage
Import this class when you need to generate synthetic multi-table relational data. It requires a Metadata object with defined relationships.
Code Reference
Source Location
- Repository: SDV
- File: sdv/multi_table/hma.py
- Lines: L187-206
Signature
class HMASynthesizer(HMASynthesizerBase, BaseHierarchicalSampler):
def __init__(self, metadata, locales=['en_US'], verbose=True):
"""
Args:
metadata (Metadata): Multi-table metadata with relationships.
locales (list): Locale(s) for AnonymizedFaker. Defaults to ['en_US'].
verbose (bool): Print progress during fit/sample. Defaults to True.
"""
Import
from sdv.multi_table import HMASynthesizer
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| metadata | Metadata | Yes | Multi-table metadata with relationships defined |
| locales | list | No | Locale(s) for fake data (default: ['en_US']) |
| verbose | bool | No | Print progress (default: True) |
Outputs
| Name | Type | Description |
|---|---|---|
| instance | HMASynthesizer | Unfitted multi-table synthesizer |
Usage Examples
from sdv.datasets.demo import download_demo
from sdv.multi_table import HMASynthesizer
data, metadata = download_demo(modality='multi_table', dataset_name='fake_hotels')
synthesizer = HMASynthesizer(metadata)
synthesizer.fit(data)
synthetic_data = synthesizer.sample(scale=1.0)
for table_name, df in synthetic_data.items():
print(f"{table_name}: {len(df)} rows")
Related Pages
Implements Principle
Requires Environment
Uses Heuristic
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment