PySynth: Dataset Synthesis for Python
PySynth is a package to create synthetic datasets - that is, datasets that look just like the original in terms of statistical properties, variable values, distributions and correlations, but do not have exactly the same contents so are safe against data disclosure. An alternative to R's Synthpop with a more permissive license.
Installation
You can get PySynth from PyPI by using the obvious
pip install pysynth
Usage
You can perform the synthesis with basic settings directly on a CSV file:
python -m pysynth source.csv synthesized.csv
This produces a synthesized.csv file that will look a lot like the original
(variable names values, distributions, correlations) but will (most likely)
not be the same.
For better control, it is best to use the synthesizer objects. They follow the
scikit-learn interface for Pandas dataframes so you fit() them on the
original and then sample(n) to get a synthetic dataframe of n rows.
So far, only a synthesizer based on iterative proportional fitting
(pysynth.ipf.IPFSynthesizer) is available. This synthesis bins continuous
variables to categories and reconstructs them using fitted univariate
distributions. Missing values (NaN) are preserved.
Synthesis quality measurement modules to be added.
Contributors
Feedback, additions, suggestions, issues and pull requests are welcome and much appreciated on GitHub.
How to add features:
- Fork it (https://github.com/simberaj/pysynth/fork)
- Create your feature branch (
git checkout -b feature/feature-name) - Commit your changes (
git commit -am "feature-name added") - Push to the branch (
git push origin feature/feature-name) - Create a new pull request
Development requires pytest for testing and sphinx to generate
documentation. Tests can be run using simple
pytest tests
Intended development directions
- Synthesis quality measurement in terms of anonymization/similarity
- Model-based synthesis along the lines of R's Synthpop
License and author info
PySynth is developed by Jan Šimbera simbera.jan@gmail.com.
PySynth is available under the MIT license. See LICENSE.txt for more details.
Release files for pysynth 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pysynth-0.0.4.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pysynth-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.4 kB
Release files / pysynth-0.0.4.tar.gz
| Download URL | pysynth-0.0.4.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
996703b8a3585dd766e79a6969d25d4cc76f921461f903cf15165d59ed23f6d5
|
|
BLAKE2b-256 checksum How to use checksums |
96a7852abd24b6e894ebf9fbc44bbbc14a145bcfef07d14bc8fb7f8bc8e2086d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5
|
Release files / pysynth-0.0.4-py3-none-any.whl
| Download URL | pysynth-0.0.4-py3-none-any.whl |
|---|---|
| Size | 14.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a00853471996ddc3513a621155007d998a046c202691b57ab9b76eed2a0db2b1
|
|
BLAKE2b-256 checksum How to use checksums |
6d1faa1587287d24aaefb88a098fb2aa027a7ea019bd1576bb16565fac71fdd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5
|