Skip to main content

Private Accurate Combination (PAC) Synthesizers

Project description

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.

The synthesizers aim to privately keep the accuracy of the attribute combinations counts from the original dataset, as well as the statistical distributions of the original data.

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 using a specified reporting length, and synthesize data based on the computed aggregated counts.

Installation

pip install pac-synth

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 synthetic-showcase@microsoft.com.

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

pac_synth-0.0.1.tar.gz (89.2 kB view details)

Uploaded Source

Built Distributions

pac_synth-0.0.1-cp37-abi3-win_amd64.whl (479.4 kB view details)

Uploaded CPython 3.7+ Windows x86-64

pac_synth-0.0.1-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ x86-64

pac_synth-0.0.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.2 MB view details)

Uploaded CPython 3.7+ macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

File details

Details for the file pac_synth-0.0.1.tar.gz.

File metadata

  • Download URL: pac_synth-0.0.1.tar.gz
  • Upload date:
  • Size: 89.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.13.1

File hashes

Hashes for pac_synth-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3e33f5cb8af1f2bed9419bf10d6791ed1656ec0e6c5bae1bb7a0306e72f27da9
MD5 8eb3ce2f995dbe4a755e142c7a0bf47d
BLAKE2b-256 bd80899dfc3a3c56e2b27ce860023cf2be00e4e67a64a392cf7bdc8ab7accac3

See more details on using hashes here.

File details

Details for the file pac_synth-0.0.1-cp37-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pac_synth-0.0.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2323b1a62e43038957e3166951ef37b41ddfdb0574095c6fd5ed6e138b04a673
MD5 c3cbc37bddf77b48196a90ece5cfe8eb
BLAKE2b-256 7614d946eb8adfcf26d7110692b73e0bc1b35e0b63349f3871430caf0d6bdf83

See more details on using hashes here.

File details

Details for the file pac_synth-0.0.1-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pac_synth-0.0.1-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9dfa2c4da02115040f3286334f3c2d37da443e0cde55cd843b0f595abe78828e
MD5 3c3f03dd12cdfb1cb54bea37219dbcd1
BLAKE2b-256 582a684df217e4082b2cfd729f6d633283378a3e4c07ebf473bba3c398c08ba7

See more details on using hashes here.

File details

Details for the file pac_synth-0.0.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for pac_synth-0.0.1-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b40c2f903827ef03e4e0dd5f4bdee2b7cbc7a70fef6cf46af63d90e7ac82424e
MD5 df6904db99011089a679d00e634c34e9
BLAKE2b-256 e6fbbcb8d5a03b561bb4b157cf2263dfd587556c8f8cc9fabca4fa189270fb78

See more details on using hashes here.

Supported by

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