RelGen
RelGen is the abbreviation of Relation Generation. This tool is used to generate relational data in databases. On the other hand, the pronunciation of Rel is similar to Real, which means that the relational data generated by RelGen is very real.
Overview
RelGen is a Python library designed to generate real relational data for users. RelGen uses a variety of advanced deep generative models and algorithms to learn data distribution from real data and generate high-quality simulation data.
Figure: RelGen Overall Architecture
Features
Generate relational data using deep generative models. RelGen provides a variety of deep generative models, including Generative Adversarial Network (GAN), Autoregressive Model (AR Model) and Diffusion Model.
Generate data for multiple relational tables. RelGen can flexibly generate data for multiple relational tables in the database, so that the data distribution of each generated table is close to that of the original table, and the joined table can also be similar to the original joined table.
Evaluate the quality of generated relational data. RelGen evaluates the generated relational data in terms of fidelity, privacy, and diversity, and visualizes the quality of the generated relational data using histogram and t-SNE plot.
Installation
RelGen requires Python version 3.7 or later.
Install from pip
pip install relgen
Install from source
git clone https://github.com/ruc-datalab/RelGen.git && cd RelGen
pip install -r requirements.txt
Quick-Start
Load Dataset
Load a demo dataset to get started. This dataset is a single table describing the census.
Load metadata for the census dataset.
from relgen.data.metadata import Metadata
metadata = Metadata()
metadata.load_from_json("datasets/census/metadata.json")
Load data for the census dataset.
import pandas as pd
data = {
"census": pd.read_csv("datasets/census/census.csv")
}
Encapsulate the census dataset and process it.
from relgen.data.dataset import Dataset
dataset = Dataset(metadata)
dataset.fit(data)
Generating Data
Train the synthesizer.
from relgen.synthesizer.arsynthesizer import MADESynthesizer
synthesizer = MADESynthesizer(dataset)
synthesizer.fit(data)
Generate relational data.
sampled_data = synthesizer.sample()
Evaluating Data
Compare real data and generated data to evaluate the quality of generated data.
from relgen.evaluator import Evaluator
evaluator = Evaluator(data["census"], sampled_data["census"])
Show comparison histogram of data distribution between real data and generated data.
evaluator.eval_histogram(columns=["age", "sex", "relationship"])
Show comparison t-SNE plot of data distribution between real data and generated data.
evaluator.eval_tsne()
Metadata
Release files for relgen 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| relgen-0.1.1.tar.gz | 58.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| relgen-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 130.2 kB
Release files / relgen-0.1.1.tar.gz
| Download URL | relgen-0.1.1.tar.gz |
|---|---|
| Size | 58.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a01acf9bb4227fbce0ce6dd8e11eac0959a879766923df7cb78abc1266088919
|
|
BLAKE2b-256 checksum How to use checksums |
7120f5cebb85e46801627eac607da224277fe2887fe791a35b4502d63a95c8da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.8.11
|
Release files / relgen-0.1.1-py3-none-any.whl
| Download URL | relgen-0.1.1-py3-none-any.whl |
|---|---|
| Size | 71.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad8edf4845e86a4b3a230f985dd469dd18bbc05152f949c0ffaee6f4a53decda
|
|
BLAKE2b-256 checksum How to use checksums |
32a6fd8e3c8ea3857f86b1636adecefe75e440bc164be6e31fd910204b29d58a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.8.11
|