Private Accurate Combination (PAC) Synthesizers
Library to generate synthetic data for privacy-preserving data sharing and analysis.
Python library exposing a set of synthesizers based on the Synthetic Data Showcase project.
These synthesizers aim to replicate the counts of attribute combinations in a sensitive dataset while maintaining differential privacy.
Available synthesizers
DpAggregateSeededSynthesizer: a differentially-private synthesizer that relies on DP Marginals to build synthetic data. It will compute DP Marginals (called aggregates) for your dataset up to and including a specifiedreporting length, and synthesize data based on the computed aggregated counts.
For more information about the DP approach please refer to the DP documentation on SDS.
Installation
pip install pac-synth
If there are no pre-built wheels for your system, you will need Rust tooling installed, so it can be compiled locally.
Using
Check our detailed and short notebook examples for more information.
from pacsynth import Dataset, DpAggregateSeededParametersBuilder, DpAggregateSeededSynthesizer
from utils import gen_data_frame
# this generates a random pandas data frame with 5000 records
# replace this with your own data
sensitive_df = gen_data_frame(5000)
dataset = Dataset.from_data_frame(sensitive_df)
# build synthesizer
synth = DpAggregateSeededSynthesizer(
DpAggregateSeededParametersBuilder().epsilon(0.5).build()
)
synth.fit(dataset)
# sample 5000 records and build a data frame
synthetic_raw_data = synth.sample(5000)
synthetic_df = Dataset.raw_data_to_data_frame(synthetic_raw_data)
# show 10 example records
print(synthetic_df.sample(10))
# this will output
# H1 H2 H3 H4 H5 H6 H7 H8 H9 H10
# 1858 2 2 2 1 1 1 1 1 1 1
# 4218 4 10
# 2346 2 4 6 1 1 1 1 1 1 1
# 3594 1 6 1
# 4059 2 6 6
# 2042 2 3 1 1 1 1 1 1 1 1
# 4546 10
# 2443 2 4 8 1 1 1 1 1 1 1
# 831 1 4 6 1 1 1 1 1 1 1
# 20 1 1 1 1 1 1 1 1 1 1
License
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Contact
Feedback and suggestions are welcome via email to sds-team@microsoft.com.
Metadata
Release files for pac-synth 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pac_synth-0.0.8.tar.gz | 100.6 kB | Without provenance | Details for pac_synth-0.0.8.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pac_synth-0.0.8-cp37-abi3-win_amd64.whl | CPython 3.7 | abi3 | Windows x86-64 | Details for pac_synth-0.0.8-cp37-abi3-win_amd64.whl |
| pac_synth-0.0.8-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.7 | abi3 | Linux glibc 2.17+ x86-64 | Details for pac_synth-0.0.8-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| pac_synth-0.0.8-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl | CPython 3.7 | abi3 | macOS 10.9+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.9+ x86-64 | Details for pac_synth-0.0.8-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl |
Total release size: 3.4 MB
Release files / pac_synth-0.0.8.tar.gz
| Download URL | pac_synth-0.0.8.tar.gz |
|---|---|
| Size | 100.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82dbe42b2ab59464f6e672edd31336902f2571e8f37bca7b569e2b6eef22e027
|
|
BLAKE2b-256 checksum How to use checksums |
8a2a0774b1efc51d2a612d63d9a390f5e5179c820caebcc49e17aae06af43e80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.15
|
Release files / pac_synth-0.0.8-cp37-abi3-win_amd64.whl
| Download URL | pac_synth-0.0.8-cp37-abi3-win_amd64.whl |
|---|---|
| Size | 486.9 kB |
| Tags | CPython 3.7 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fbe1fc338ac2eb4e80fa8db3fceb2aed1be24bf4fe47c5293561b3314a358f8e
|
|
BLAKE2b-256 checksum How to use checksums |
fdec3be3e33276ac57e3eeb3efac0eafd81a0fd074286edbd415f7677072f1ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.15
|
Release files / pac_synth-0.0.8-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pac_synth-0.0.8-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.7 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8fc9c15e897ff4b2dc00bad9c37994c117327d741852781cae56e5f40fe7498a
|
|
BLAKE2b-256 checksum How to use checksums |
75e7a74743254689b1144c7b30d6920b1642f8d4605c127d0acf5d7231035e9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.15
|
Release files / pac_synth-0.0.8-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
| Download URL | pac_synth-0.0.8-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.7 abi3 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
96f22d653b13da289fe76086d938e124881c5923cd49bbabd8198bdd2a1cbfae
|
|
BLAKE2b-256 checksum How to use checksums |
a1d63b4a024e4409c76c48d85e610b804fff71e71d6283dd4c7161c717b72be2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/0.14.15
|
Security for pac-synth 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.