A Python package to create synthetic data from a locally estimated distributions.
Project description
synloc: An Algorithm to Create Synthetic Tabular Data
Overview
synloc
is an algorithm to sequentially and locally estimate distributions to create synthetic versions of a tabular data. The proposed methodology can be combined with parametric and nonparametric distributions.
Installation
synloc
can be installed through PyPI:
pip install synloc
A Quick Example
Assume that we have a sample with three variables with the following distributions:
$$x \sim Beta(0.1,,0.1)$$ $$y \sim Beta(0.1,, 0.5)$$ $$z \sim 10 y + Normal(0,,1)$$
The distribution can be generated by tools
module in synloc
:
from synloc.tools import sample_trivariate_xyz
data = sample_trivariate_xyz() # Generates a sample with size 1000 by default.
Initializing the resampler:
from synloc import LocalCov
resampler = LocalCov(data = data, K = 30)
Subsample size is defined as K=30
. Now, we locally estimate the multivariate normal distribution and from each estimated distributions we draw "synthetic values."
syn_data = resampler.fit()
100%|██████████| 1000/1000 [00:01<00:00, 687.53it/s]
syn_data
is a pandas.DataFrame where all variables are synthesized. Comparing the original sample using a 3-D Scatter:
resampler.comparePlots(['x','y','z'])
How to cite?
If you use synloc
in your research, please cite the following paper:
@article{kalay2022generating,
title={Generating Synthetic Data with The Nearest Neighbors Algorithm},
author={Kalay, Ali Furkan},
journal={arXiv preprint arXiv:2210.00884},
year={2022}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file synloc-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: synloc-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a9883f1b6197ab0a9fc339674c68155cdbf348b814e8e4db628bfcec8a91466 |
|
MD5 | bce87de03018aafd393d5f8f9784a97e |
|
BLAKE2b-256 | 959fd0665adfc49c0e4b4bed32b41eb65ffe5e99862658d24f49ba9351f09cc9 |