org.deidentifier.arx.dp

## Class ExponentialMechanism<T>

- java.lang.Object
- - org.deidentifier.arx.dp.ExponentialMechanism<T>

    public class ExponentialMechanism<T>
    extends java.lang.Object

An implementation of the exponential mechanism for discrete domains as proposed in: McSherry, Frank, and Kunal Talwar: Mechanism design via differential privacy. Foundations of Computer Science 2007. pp. 94-103 This implementation assumes that all score values have been divided by the sensitivity of the respective score function. We point out that this implementation draws from a probability distribution which approximates the mathematically precise distribution of the exponential mechanism as a consequence of floating-point arithmetic, which could potentially affect the privacy guarantees provided. However, it can be shown that the resulting absolute exceedance of the privacy parameter epsilon is at most in the order of E = log( (1 + n * 2^{-51})^2 ) where n is the size of the domain. For various values of n, these absolute errors are as follows: ------------------------------------------------------------------------------------------------------------------------ | n | 10^1 | 10^2 | 10^3 | 10^4 | 10^5 | 10^6 | 10^7 | 10^8 | 10^9 | ------------------------------------------------------------------------------------------------------------------------ | E | 9*10^{-15} | 9*10^{-14} | 9*10^{-13} | 9*10^{-12} | 9*10^{-11} | 9*10^{-10} | 9*10^{-9} | 9*10^{-8} | 9*10^{-7} | ------------------------------------------------------------------------------------------------------------------------

Author:
  Raffael Bild

### Constructor Summary

Constructors
Constructor and Description
`ExponentialMechanism(double epsilon)` Constructs a new instance
`ExponentialMechanism(double epsilon, boolean deterministic)` Constructs a new instance Note: *never* set deterministic to true in production.

### Method Summary

All Methods Instance Methods Concrete Methods
`T` `sample()` Returns a random sampled value
`void` `setDistribution(T[] values, double[] scores)` Sets the distribution to sample from.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ExponentialMechanism

    public ExponentialMechanism(double epsilon)

Constructs a new instance

Parameters:
  `epsilon` -

#### ExponentialMechanism

    public ExponentialMechanism(double epsilon,
                                boolean deterministic)

Constructs a new instance Note: *never* set deterministic to true in production. It is implemented for testing purposes, only.

Parameters:
  `epsilon` -
  `deterministic` -

### Method Detail

#### sample

    public T sample()

Returns a random sampled value

Returns:

#### setDistribution

    public void setDistribution(T[] values,
                                double[] scores)

Sets the distribution to sample from. The arrays values and scores have to have the same length.

Parameters:
  `values` -
  `scores` -