Skip to main content

Tools for analyzing and comparing different sampling schemes in differential privacy

Project description

Random Allocation for Differential Privacy

This package provides tools for analyzing and comparing different random allocation schemes in the context of differential privacy.

Installation

You can install the package using pip:

pip install random-allocation

Usage

Here's a simple example of how to use the package to run experiments:

from random_allocation import run_experiment, PlotType
from random_allocation import ALLOCATION, ALLOCATION_ANALYTIC, ALLOCATION_RDP, ALLOCATION_DECOMPOSITION

# Define experiment parameters
params_dict = {
    'x_var': 'sigma',
    'y_var': 'epsilon',
    'sigma': [0.1, 0.2, 0.3, 0.4, 0.5],
    'n': 1000,
    'k': 10,
    'delta': 1e-5
}

# Define configuration
config_dict = {
    'title': 'Sigma vs Epsilon',
    'x name': 'Sigma',
    'y name': 'Epsilon'
}

# Define visualization configuration
visualization_config = {
    'log_x_axis': False,
    'log_y_axis': True
}

# Define methods to compare
methods = [ALLOCATION_ANALYTIC, ALLOCATION_RDP, ALLOCATION_DECOMPOSITION]

# Run the experiment
run_experiment(
    params_dict=params_dict,
    config_dict=config_dict,
    methods=methods,
    visualization_config=visualization_config,
    experiment_name='sigma_vs_epsilon',
    plot_type=PlotType.COMPARISON,
    save_data=True,
    save_plots=True
)

Creating Custom Experiments

To create your own experiments:

  1. Create a new Python file (e.g., my_experiments.py)
  2. Import the necessary functions and constants from random_allocation
  3. Define your experiment parameters, configuration, and methods
  4. Call run_experiment with your settings

The package provides two types of plots:

  • PlotType.COMPARISON: For comparing different methods
  • PlotType.COMBINED: For showing combined results

Available Methods

The package includes several methods for comparison:

  • ALLOCATION_ANALYTIC: Our analytic method
  • ALLOCATION_RDP: Our RDP-based method
  • ALLOCATION_DECOMPOSITION: Our decomposition method

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this code in your research, please cite:

@article{yourcitation,
  title={Your Paper Title},
  author={Your Name},
  journal={Journal Name},
  year={2024}
}

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

random_allocation_fork-0.2.12.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

random_allocation_fork-0.2.12-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file random_allocation_fork-0.2.12.tar.gz.

File metadata

  • Download URL: random_allocation_fork-0.2.12.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for random_allocation_fork-0.2.12.tar.gz
Algorithm Hash digest
SHA256 680625f2dcd73dbdcf69ad53b79c697b759d62e7235069a28f44565cd358490e
MD5 30509de0af34c6f19b4b482aa064985a
BLAKE2b-256 f613bfd634194a1aaf6dfe4293cf2c162d823e90c53782a6d8382782d68bbe68

See more details on using hashes here.

File details

Details for the file random_allocation_fork-0.2.12-py3-none-any.whl.

File metadata

File hashes

Hashes for random_allocation_fork-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 c0379c8caf307506a240b69d6bbeab6aa8674fdb6d76482f3fadc5d358273fb6
MD5 c61857bd2f0f49baa61743126e8cb8f8
BLAKE2b-256 ec84b7f6c28f3c1f8f792ebb12b4bf98252c86f83ece66657f078991b7319c22

See more details on using hashes here.

Supported by

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