opendp/smartnoise-sdk
소개
Tools and service for differentially private processing of tabular and relational data
보안 및 개인정보 보호측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalSmartNoise SDK: Tools for Differential Privacy on Tabular Data
The SmartNoise SDK includes 2 packages:
- smartnoise-sql: Run differentially private SQL queries
- smartnoise-synth: Generate differentially private synthetic data
To get started, see the examples below. Click into each project for more detailed examples.
SQL
Install
pip install smartnoise-sql
Query
import snsql
from snsql import Privacy
import pandas as pd
csv_path = 'PUMS.csv'
meta_path = 'PUMS.yaml'
data = pd.read_csv(csv_path)
privacy = Privacy(epsilon=1.0, delta=0.01)
reader = snsql.from_connection(data, privacy=privacy, metadata=meta_path)
result = reader.execute('SELECT sex, AVG(age) AS age FROM PUMS.PUMS GROUP BY sex')
print(result)
PUMS.csv and PUMS.yaml can be found in the datasets folder.
See the SQL project
Synthesizers
Install
pip install smartnoise-synth
MWEM
import pandas as pd
import numpy as np
pums = pd.read_csv(pums_csv_path, index_col=None) # in datasets/
pums = pums.drop(['income'], axis=1)
nf = pums.to_numpy().astype(int)
synth = snsynth.MWEMSynthesizer(epsilon=1.0, split_factor=nf.shape[1])
synth.fit(nf)
sample = synth.sample(10) # get 10 synthetic rows
print(sample)
PATE-CTGAN
import pandas as pd
import numpy as np
from snsynth.pytorch.nn import PATECTGAN
from snsynth.pytorch import PytorchDPSynthesizer
pums = pd.read_csv(pums_csv_path, index_col=None) # in datasets/
pums = pums.drop(['income'], axis=1)
synth = PytorchDPSynthesizer(1.0, PATECTGAN(regularization='dragan'), None)
synth.fit(pums, categorical_columns=pums.columns.values.tolist())
sample = synth.sample(10) # synthesize 10 rows
print(sample)
See the Synthesizers project
Communication
- You are encouraged to join us on GitHub Discussions
- Please use GitHub Issues for bug reports and feature requests.
- For other requests, including security issues, please contact us at [email protected].
Releases and Contributing
Please let us know if you encounter a bug by creating an issue.
We appreciate all contributions. Please review the contributors guide. We welcome pull requests with bug-fixes without prior discussion.
If you plan to contribute new features, utility functions or extensions to this system, please first open an issue and discuss the feature with us.
관련 프로젝트 살펴보기
불러오는 중…