pe.dp package
- class pe.dp.DP[source]
Bases:
ABC
The abstract class for Differential Privacy (DP) histogram mechanism.
- abstract add_noise(syn_data)[source]
Add noise to the histogram of synthetic data.
- Parameters:
syn_data (
pe.data.Data
) – The synthetic data to add noise
- abstract set_epsilon_and_delta(num_iterations, epsilon, delta, noise_multiplier)[source]
Set the epsilon and delta for the DP mechanism. Either epsilon or noise_multiplier should be None.
- Parameters:
num_iterations (int) – The number of PE iterations
epsilon (float or None) – The epsilon value of DP
delta (float) – The delta value of DP
noise_multiplier (float or None) – The noise multiplier of the DP mechanism
- class pe.dp.Gaussian[source]
Bases:
DP
The Gaussian mechanism for Differential Privacy (DP) histogram.
- add_noise(syn_data)[source]
Add noise to the histogram of synthetic data.
- Parameters:
syn_data (
pe.data.Data
) – The synthetic data to add noise. The synthetic data should have thepe.constant.data.CLEAN_HISTOGRAM_COLUMN_NAME
column- Returns:
The synthetic data with noise added to the histogram. The noisy histogram is stored in the
pe.constant.data.DP_HISTOGRAM_COLUMN_NAME
column- Return type:
- set_epsilon_and_delta(num_iterations, epsilon, delta, noise_multiplier)[source]
Set the epsilon and delta for the Gaussian mechanism.
- Parameters:
num_iterations (int) – The number of PE iterations
epsilon (float) – The epsilon value of DP
delta (float) – The delta value of DP
noise_multiplier (float) – The noise multiplier of the DP mechanism
- Raises:
ValueError – If delta is None
ValueError – If both epsilon and noise_multiplier are None or not None