Function smartnoise_runtime::utilities::mechanisms::snapping_mechanism [−][src]
pub fn snapping_mechanism(
value: f64,
epsilon: f64,
sensitivity: f64,
min: f64,
max: f64,
binding_probability: Option<f64>,
enforce_constant_time: bool
) -> Result<f64>
Computes privatized value according to the Snapping mechanism
Developed as a variant of the Laplace mechanism which does not suffer from floating-point side channel attacks. For more information, see Mironov (2012)
Arguments
value
- Non-private value of the statistic to be privatized.epsilon
- Desired privacy guarantee.sensitivity
- l1 Sensitivity of function to which mechanism is being applied.min
- Lower bound on function value being privatized.max
- Upper bound on function value being privatized.binding_probability
- Optional. Probability of binding on the final clampenforce_constant_time
- Whether or not to enforce the algorithm to run in constant time
Returns
Result of snapping mechanism
Example
use smartnoise_runtime::utilities::mechanisms::snapping_mechanism; let value: f64 = 50.0; let epsilon: f64 = 1.0; let min: f64 = -50.; let max: f64 = 150.0; let sensitivity: f64 = 1.0/1000.0; let precision: i64 = 118; snapping_mechanism(value, epsilon, sensitivity, min, max, None, false).unwrap(); println!("snapped value: {}", value);