Standalone PrivSyn core for differentially private discrete tabular synthesis.
Project description
privsyn-core
privsyn-core packages the discrete PrivSyn algorithm as a standalone Python
library. It is intentionally narrower than the full privsyn-tabular project:
it expects an already encoded dataframe whose values are integer ids within the
provided per-column domain sizes.
Scope
- Includes the PrivSyn marginal selection and GUM synthesis core.
- Excludes the web app, FastAPI service, frontend, and framework-specific adapter/registry layers.
- Excludes raw tabular preprocessing from mixed numeric/categorical data.
Install
pip install privsyn-core
Usage
import pandas as pd
from privsyn import PrivSynModel
df = pd.DataFrame(
{
"age_bin": [0, 1, 0, 2, 1, 2],
"sex": [0, 1, 1, 0, 1, 0],
"race": [0, 1, 2, 0, 1, 2],
}
)
domain = {"age_bin": 3, "sex": 2, "race": 3}
model = PrivSynModel(
epsilon=1.0,
delta=1e-6,
random_state=0,
extra_params={
"update_iterations": 5,
"consist_iterations": 25,
},
)
model.fit(df, domain)
synthetic = model.sample(100)
print(synthetic.head())
Notes
- Use
artifact_root=...if you want persisted marginal artifacts in a specific directory. - By default the package uses a temp directory under the system temp root.
Release Automation
This repository includes a GitHub Actions workflow at
.github/workflows/privsyn-core-package.yml that automates validation and
publishing for privsyn-core.
- Pull requests and pushes touching
packages/privsyn-core/run package tests, build bothsdistandwheel, runtwine check, and smoke-test the built wheel in a fresh virtual environment. - Manual publish:
open the
PrivSyn Core Packageworkflow and choosetestpypiorpypi. - Tag publish:
pushing a tag named like
privsyn-core-v0.1.0triggers a PyPI publish.
One-time setup
Configure trusted publishing on PyPI and TestPyPI for this GitHub repository. Use these environment names in GitHub:
testpypipypi
Then add matching trusted publisher entries on the package index side for this
repository, the privsyn-core-package.yml workflow, and the corresponding
testpypi / pypi environment.
If you prefer token-based publishing instead, you can replace the publish steps
with password: ${{ secrets.PYPI_API_TOKEN }} style configuration, but trusted
publishing is the cleaner default.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file privsyn_core-0.1.0.tar.gz.
File metadata
- Download URL: privsyn_core-0.1.0.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbf8d210544d4d24fe1564f132803b23e3038085a7742f1d7ba36e5c965ac181
|
|
| MD5 |
82e3b7e4a5da92a5ece5d2fc6d4da32a
|
|
| BLAKE2b-256 |
c917d8b4c15947c64c8d8969e7f3f143312111aea4ecbe09838dafdfd2b8fcc0
|
Provenance
The following attestation bundles were made for privsyn_core-0.1.0.tar.gz:
Publisher:
privsyn-core-package.yml on vvv214/privsyn-tabular
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privsyn_core-0.1.0.tar.gz -
Subject digest:
fbf8d210544d4d24fe1564f132803b23e3038085a7742f1d7ba36e5c965ac181 - Sigstore transparency entry: 1199822049
- Sigstore integration time:
-
Permalink:
vvv214/privsyn-tabular@4529548e7096a35cd67effd3a6b1b8c9890f0a08 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vvv214
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
privsyn-core-package.yml@4529548e7096a35cd67effd3a6b1b8c9890f0a08 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file privsyn_core-0.1.0-py3-none-any.whl.
File metadata
- Download URL: privsyn_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 28.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ea7951c0d6c90888f9f39656ce86cec5d0977a55c03032d93325f2d5c90c104
|
|
| MD5 |
6d79f488555aa006f4c3a694b6c2c13e
|
|
| BLAKE2b-256 |
08c0a7a30d12c768d2533fecc3c5e503d970fe1f067f3cc3f6d2bd7f7922058f
|
Provenance
The following attestation bundles were made for privsyn_core-0.1.0-py3-none-any.whl:
Publisher:
privsyn-core-package.yml on vvv214/privsyn-tabular
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
privsyn_core-0.1.0-py3-none-any.whl -
Subject digest:
5ea7951c0d6c90888f9f39656ce86cec5d0977a55c03032d93325f2d5c90c104 - Sigstore transparency entry: 1199822083
- Sigstore integration time:
-
Permalink:
vvv214/privsyn-tabular@4529548e7096a35cd67effd3a6b1b8c9890f0a08 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vvv214
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
privsyn-core-package.yml@4529548e7096a35cd67effd3a6b1b8c9890f0a08 -
Trigger Event:
workflow_dispatch
-
Statement type: