Skip to main content

Repository of differentially-private methods for learning from features.

Project description

Description

Repository of differentially-private methods for learning from features.

Usage

Installation

pip install dp-learning-ff

Private Prototype Calculation

  1. Set your total privacy budget in (0,rho)-zCDP.
  2. Divide your total budget into a budget per step. Good starting values are listed below. The algorithm will perform len(Ps) many steps.
Ps = [rho] # One iteration
Ps = [5 / 64 * rho, 7 / 64 * rho, 52 / 64 * rho] # Three iterations
  1. Call the private prototype calculation using your train_preds, train_targets and Ps as outlined above.
num_samples = 100
dimensionality = 10
num_classes = 5
train_preds = np.random.normal(0,1,(num_samples, dimensionality))
train_targets = np.random.randint(num_classes, size=(num_samples)) # Supports unbalanced classes
private_prototypes = dp_learning_ff.give_private_prototypes(train_preds, train_targets, Ps)
>>> private_prototypes.shape
(5, 10)
>>> private_prototypes
array([[-1.08239659,  0.50517265,  0.46295668,  0.11665974, -0.41539363,
         0.46428818, -0.30204127, -0.20684517, -0.11748276, -0.44173581],
       [-0.97640077,  0.73495051, -0.3125302 ,  0.39733846, -0.15187237,
        -0.09618042,  0.50008494,  0.06408969, -0.59472233,  0.56000984],
       [-0.07384877, -0.04661516,  0.83469973, -0.18854654, -0.3631222 ,
        -0.56158617,  0.03480437, -0.17749153, -0.25144926,  0.99669163],
       [ 0.02682651, -0.57948712, -0.33462215,  0.32657359, -0.13894844,
        -1.16420508,  0.84630674, -0.0343235 , -0.38193481,  0.29124748],
       [ 1.12158357,  0.17188541, -0.2582887 , -0.2140504 ,  0.06759121,
        -0.26975582, -0.46858189,  0.67295234,  0.64183255, -0.10445519]])

Acknowledgements

Prototype Calculations use the coinpress algorithm from the paper CoinPress: Practical Private Mean and Covariance Estimation, authored by Sourav Biswas, Yihe Dong, Gautam Kamath, Jonathan Ullman. Code contributed by all four authors.

@incollection{BiswasDKU20,
  title         = {CoinPress: Practical Private Mean and Covariance Estimation},
  author        = {Biswas, Sourav and Dong, Yihe and Kamath, Gautam and Ullman, Jonathan},
  booktitle = {Advances in Neural Information Processing Systems 33},
  url       = {arXiv preprint arXiv:2006.06618},
  year          = {2020}
}

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

dp_learning_ff-0.0.7.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

dp_learning_ff-0.0.7-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file dp_learning_ff-0.0.7.tar.gz.

File metadata

  • Download URL: dp_learning_ff-0.0.7.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for dp_learning_ff-0.0.7.tar.gz
Algorithm Hash digest
SHA256 fd7dc2234e528982d62ff599dc4409b4453d332a564d403c978c560661707707
MD5 a58c767f33ab4bddbd7e8f985e135607
BLAKE2b-256 df53cd45f7819cf19580aea38917fdf1117f2b1b1d1ddcb205d3c81e5c3f776d

See more details on using hashes here.

File details

Details for the file dp_learning_ff-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for dp_learning_ff-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 75ed0a704c1306c91cccdc9562ad1b676c8a14a9b5e1fbb1b2602b5ed70973f0
MD5 18bf14df77c1d422985ba8280a463983
BLAKE2b-256 04e630fcd96f9b574624b84cc6e918d250797920a56592a1a63ee86f4e1ae7f1

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