Skip to main content

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}
}

Metadata

Release files for random-allocation-fork 0.2.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for random-allocation-fork 0.2.12
File Size Uploaded
random_allocation_fork-0.2.12.tar.gz 21.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for random-allocation-fork 0.2.12
File Interpreter ABI Platform
random_allocation_fork-0.2.12-py3-none-any.whl Python 3 none any Details

Total release size: 49.8 kB

Release files / random_allocation_fork-0.2.12.tar.gz

Download URL random_allocation_fork-0.2.12.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
680625f2dcd73dbdcf69ad53b79c697b759d62e7235069a28f44565cd358490e
BLAKE2b-256 checksum
How to use checksums
f613bfd634194a1aaf6dfe4293cf2c162d823e90c53782a6d8382782d68bbe68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / random_allocation_fork-0.2.12-py3-none-any.whl

Download URL random_allocation_fork-0.2.12-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0379c8caf307506a240b69d6bbeab6aa8674fdb6d76482f3fadc5d358273fb6
BLAKE2b-256 checksum
How to use checksums
ec84b7f6c28f3c1f8f792ebb12b4bf98252c86f83ece66657f078991b7319c22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.2.12 This release

2 release files

0.2.11

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page