Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Sdv dev SDV PARSynthesizer Init

From Leeroopedia
Knowledge Sources
Domains Time_Series, Synthetic_Data
Last Updated 2026-02-14 00:00 GMT

Overview

Concrete tool for creating a PAR-based synthesizer for sequential synthetic data generation, provided by the SDV library.

Description

The PARSynthesizer uses DeepEcho's PARModel for sequential column generation and a GaussianCopulaSynthesizer for context column modeling. It requires metadata with a sequence key column and supports configurable context columns, segment sizes for long sequences, and training hyperparameters.

Usage

Import this class when generating synthetic sequential or time-series data. The metadata must have a sequence key column defined with sdtype='id'.

Code Reference

Source Location

  • Repository: SDV
  • File: sdv/sequential/par.py
  • Lines: L140-194

Signature

class PARSynthesizer(MissingModuleMixin, BaseSingleTableSynthesizer):
    def __init__(
        self,
        metadata,
        enforce_min_max_values=True,
        enforce_rounding=True,
        locales=['en_US'],
        context_columns=None,
        segment_size=None,
        epochs=128,
        sample_size=1,
        cuda=True,
        verbose=False,
    ):
        """
        Args:
            metadata (Metadata): Table metadata with sequence key.
            enforce_min_max_values (bool): Clip values. Defaults to True.
            enforce_rounding (bool): Round values. Defaults to True.
            locales (list): Locale(s). Defaults to ['en_US'].
            context_columns (list or None): Columns constant within sequences.
            segment_size (int or None): Segment length for long sequences.
            epochs (int): Training epochs. Defaults to 128.
            sample_size (int): Samples per timestep. Defaults to 1.
            cuda (bool): Use CUDA. Defaults to True.
            verbose (bool): Print progress. Defaults to False.
        """

Import

from sdv.sequential import PARSynthesizer

I/O Contract

Inputs

Name Type Required Description
metadata Metadata Yes Metadata with sequence key column (sdtype='id')
context_columns list or None No Columns constant within a sequence
segment_size int or None No Segment splitting for long sequences
epochs int No Training epochs (default: 128)
cuda bool No Use GPU (default: True)

Outputs

Name Type Description
instance PARSynthesizer Unfitted sequential synthesizer

Usage Examples

from sdv.datasets.demo import download_demo
from sdv.sequential import PARSynthesizer

data, metadata = download_demo(modality='sequential', dataset_name='nasdaq100_2019')

synthesizer = PARSynthesizer(
    metadata,
    context_columns=['Sector', 'Industry'],
    epochs=64,
)
synthesizer.fit(data)
synthetic_data = synthesizer.sample(num_sequences=10)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment