Python API

Python API

Documentation of PETsARD’s Python API.

⚠️
Important Note: This package expects users to control execution using Executor with YAML. Users are not expected to directly use internal modules. This documentation is for internal development team reference only. Any changes to these module functions will not be considered BREAKING CHANGES and backward compatibility is not guaranteed.

Design Principles

Adapter Pattern

Uses the adapter design pattern to unify module interfaces through the Adapter layer, allowing Executor to execute all components consistently:

  • create() - Create instance
  • fit_sample() / eval() / report() - Execute methods (train and generate / execute evaluation / output report)

Each module is wrapped by an Adapter to ensure standardized external interfaces.

Immutable Objects

All configuration classes are frozen dataclasses to ensure data safety.

Type Hints

Complete type annotations for better development experience.

Configuration and Execution

ModuleFunction
ExecutorMain interface for experiment pipeline, coordinates entire data synthesis and evaluation workflow

Data Management

ModuleFunction
MetadaterDataset structure and metadata management, handles data type definitions and validation

Pipeline Components

ModuleFunction
BenchmarkerBenchmark dataset management, automatic downloading and processing of benchmark data
LoaderData loading and processing, supports multiple file formats
SplitterExperiment data splitting, supports train/test set splitting
ProcessorData preprocessing and postprocessing, includes encoding and normalization
SynthesizerSynthetic data generation, supports multiple synthesis algorithms
ConstrainerData constraint processor for synthetic data, ensures data meets business rules
EvaluatorPrivacy, fidelity and utility evaluation, provides multi-dimensional quality assessment
DescriberDescriptive data summary, provides statistical analysis
ReporterResult export and reporting, supports multiple output formats

System Components

ModuleFunction
AdapterStandardized execution wrapper for all modules
ConfigExperiment configuration management, handles YAML configuration files
StatusPipeline state and progress tracking, provides execution monitoring
UtilsCore utility functions and external module loading