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}
}
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)
| File | Size | Uploaded | |
|---|---|---|---|
| random_allocation_fork-0.2.12.tar.gz | 21.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|