Skip to main content

A Python library for generating synthetic datasets

Project description

SynthGen

SynthGen is a Python library designed to generate synthetic datasets for testing, prototyping, and research purposes. It supports generating tabular datasets with customizable features and is designed for extensibility.

Features

  • Generate synthetic tabular datasets with numeric and categorical columns
  • Add Gaussian noise to numeric data for variability
  • Fully customizable columns and data types
  • Set random seeds for reproducibility
  • Easy-to-use API

Installation

You can install the library using pip:

pip install synthgen

Alternatively, clone the repository and install locally:

git clone https://github.com/davitacols/synthgen.git
cd synthgen
pip install .

Quick Start

Here's how you can use SynthGen to generate synthetic tabular data:

Example Usage

from synthgen.core import SynthGen

# Initialize the generator
generator = SynthGen(seed=42)

# Generate a dataset with 100 rows, 3 columns
dataset = generator.generate_tabular(
    rows=100,
    cols=3,
    col_types=['numeric', 'categorical', 'numeric'],
    noise=0.1
)

# Display the first few rows
print(dataset.head())

# Save the dataset to a CSV file
dataset.to_csv('synthetic_dataset.csv', index=False)

API Reference

Class: SynthGen

The SynthGen class provides methods for generating synthetic datasets.

Constructor

SynthGen(seed: int = None)

Parameters:

  • seed (int, optional): Random seed for reproducibility. Default is None.

Method: generate_tabular

generate_tabular(rows=100, cols=5, col_types=None, noise=0.0)

Parameters:

  • rows (int): Number of rows in the dataset
  • cols (int): Number of columns in the dataset
  • col_types (list): List of column types (numeric, categorical). Defaults to numeric for all columns
  • noise (float): Standard deviation of Gaussian noise for numeric data. Defaults to 0.0

Returns:

  • pandas.DataFrame: A DataFrame containing the generated dataset

Directory Structure

synthgen/
├── synthgen/
│   ├── __init__.py    # Package initializer
│   ├── core.py        # Core functionality
│   ├── tabular.py     # Tabular data generation
│   └── utils.py       # Helper functions
├── tests/             # Unit tests
│   ├── test_core.py   # Tests for core functionality
│   └── test_tabular.py# Tests for tabular data
├── examples/          # Example usage scripts
│   └── generate_tabular.py
├── README.md          # Project documentation
├── setup.py          # Package configuration for PyPI
├── requirements.txt   # List of dependencies
└── .gitignore        # Ignored files for Git

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

  1. Fork the repository
  2. Create a new branch for your feature or bug fix
  3. Commit your changes with a clear message
  4. Push the branch and open a pull request

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or support, reach out to:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synthro-0.1.0.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

synthro-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file synthro-0.1.0.tar.gz.

File metadata

  • Download URL: synthro-0.1.0.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for synthro-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9b4d0ff223b417e391fb4ca03c2b41d6928cc31c2b43c27f809bf35662cdf980
MD5 4edb8f5f200ff1291d82638c3c363f9d
BLAKE2b-256 a8b0229a1276cef82d9444a71e983aa221327c5afed7406a836ad4bf981f1ecb

See more details on using hashes here.

File details

Details for the file synthro-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: synthro-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for synthro-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f0694ddea763b8b68431e91d9fe63898801b2b90d941e4585967b717065fff6
MD5 89f4360ead27448e1135f2ca09ea0554
BLAKE2b-256 5069db2c05efeb337ca07bd60aad92bed07ca5694d7ecaf2a8e2ae5600279186

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page