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:
- Create a new Python file (e.g.,
my_experiments.py) - Import the necessary functions and constants from
random_allocation - Define your experiment parameters, configuration, and methods
- Call
run_experimentwith your settings
The package provides two types of plots:
PlotType.COMPARISON: For comparing different methodsPlotType.COMBINED: For showing combined results
Available Methods
The package includes several methods for comparison:
ALLOCATION_ANALYTIC: Our analytic methodALLOCATION_RDP: Our RDP-based methodALLOCATION_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
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 random_allocation_fork-0.2.11.tar.gz.
File metadata
- Download URL: random_allocation_fork-0.2.11.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7974e65bfee5c4a77a1b0e230e386d858f7f5d3c8fc9d62134cf642f981c0b1a
|
|
| MD5 |
f08882ab0d9b2b862992fd49eb30465e
|
|
| BLAKE2b-256 |
40e1680b026bd74833a5696be1389c6086f85e7f1a8c7f45e3eb3fe9cf4f409f
|
File details
Details for the file random_allocation_fork-0.2.11-py3-none-any.whl.
File metadata
- Download URL: random_allocation_fork-0.2.11-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a384ee1e62b37b461a3eb49303af0f71c40b54def85989f88c17cd34ad257448
|
|
| MD5 |
b74ff4f8e501fe153ca647ddea7a296b
|
|
| BLAKE2b-256 |
f4bc55cd8cc867620bdb3bcf16904147d528206a5b92cb345256d7f8c9b357a3
|