Class LaplaceNoise
- java.lang.Object
-
- com.google.privacy.differentialprivacy.LaplaceNoise
-
- All Implemented Interfaces:
Noise
public class LaplaceNoise extends java.lang.Object implements Noise
Generates and adds Laplace noise to a raw piece of numerical data such that the result is securely differentially private.The Laplace noise is generated according to the geometric sampling mechanism described here. This approach is robust against unintentional privacy leaks due to artifacts of floating point arithmetic.
-
-
Constructor Summary
Constructors Constructor Description LaplaceNoise()Returns a Noise instance initialized with a secure randomness source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleaddNoise(double x, double l1Sensitivity, double epsilon, java.lang.Double delta)doubleaddNoise(double x, int l0Sensitivity, double lInfSensitivity, double epsilon, java.lang.Double delta)Adds Laplace noise toxsuch that the output isepsilon-differentially private, with respect to the specified L_0 and L_inf sensitivities.longaddNoise(long x, int l0Sensitivity, long lInfSensitivity, double epsilon, java.lang.Double delta)Adds Laplace noise to the integerxsuch that the output isepsilon-differentially private, with respect to the specified L_0 and L_inf sensitivities.longaddNoise(long x, long l1Sensitivity, double epsilon, java.lang.Double delta)ConfidenceIntervalcomputeConfidenceInterval(double noisedX, int l0Sensitivity, double lInfSensitivity, double epsilon, java.lang.Double delta, double alpha)Computes a confidence interval that contains the raw valuexpassed toaddNoise(double, int, double, double, Double)with a probability equal to1 - alphabased on the specifiednoisedXand noise parameters.ConfidenceIntervalcomputeConfidenceInterval(long noisedX, int l0Sensitivity, long lInfSensitivity, double epsilon, java.lang.Double delta, double alpha)Computes a confidence interval that contains the raw integer valuexpassed toaddNoise(long, int, long, double, Double)with a probability greater or equal to1 - alphabased on the specifiednoisedXand noise parameters.doublecomputeQuantile(double rank, double x, int l0Sensitivity, double lInfSensitivity, double epsilon, java.lang.Double delta)Computes the quantile z satisfying Pr[Y <= z] =rankfor a Laplace random variable Y with meanxand variance according to the specified privacy parameters.com.google.differentialprivacy.SummaryOuterClass.MechanismTypegetMechanismType()
-
-
-
Method Detail
-
addNoise
public double addNoise(double x, int l0Sensitivity, double lInfSensitivity, double epsilon, @Nullable java.lang.Double delta)Adds Laplace noise toxsuch that the output isepsilon-differentially private, with respect to the specified L_0 and L_inf sensitivities. Note thatdeltamust be set tonullbecause it does not parameterize Laplace noise. Moreover,epsilonmust be at least 2^-50.
-
addNoise
public double addNoise(double x, double l1Sensitivity, double epsilon, @Nullable java.lang.Double delta)SeeaddNoise(double, int, double, double, Double).As opposed to the latter method, this accepts the L_1 sensitivity of
xdirectly instead of the L_0 and L_Inf proxies. This should be used in settings where it is feasible or more convenient to calculate the L_1 sensitivity directly.
-
addNoise
public long addNoise(long x, int l0Sensitivity, long lInfSensitivity, double epsilon, @Nullable java.lang.Double delta)Adds Laplace noise to the integerxsuch that the output isepsilon-differentially private, with respect to the specified L_0 and L_inf sensitivities. Note thatdeltamust be set tonullbecause it does not parameterize Laplace noise. Moreover,epsilonmust be at least 2^-50.
-
addNoise
public long addNoise(long x, long l1Sensitivity, double epsilon, @Nullable java.lang.Double delta)SeeaddNoise(long, int, long, double, Double).As opposed to the latter method, this accepts the L_1 sensitivity of
xdirectly instead of the L_0 and L_Inf proxies. This should be used in settings where it is feasible or more convenient to calculate the L_1 sensitivity directly.
-
getMechanismType
public com.google.differentialprivacy.SummaryOuterClass.MechanismType getMechanismType()
- Specified by:
getMechanismTypein interfaceNoise
-
computeConfidenceInterval
public ConfidenceInterval computeConfidenceInterval(double noisedX, int l0Sensitivity, double lInfSensitivity, double epsilon, @Nullable java.lang.Double delta, double alpha)
Computes a confidence interval that contains the raw valuexpassed toaddNoise(double, int, double, double, Double)with a probability equal to1 - alphabased on the specifiednoisedXand noise parameters. Note thatdeltamust be set tonullbecause it does not parameterize Laplace noise. Moreover,epsilonmust be at least 2^-50.Refer to this doc for more information.
- Specified by:
computeConfidenceIntervalin interfaceNoise
-
computeConfidenceInterval
public ConfidenceInterval computeConfidenceInterval(long noisedX, int l0Sensitivity, long lInfSensitivity, double epsilon, @Nullable java.lang.Double delta, double alpha)
Computes a confidence interval that contains the raw integer valuexpassed toaddNoise(long, int, long, double, Double)with a probability greater or equal to1 - alphabased on the specifiednoisedXand noise parameters. Note thatdeltamust be set tonullbecause it does not parameterize Laplace noise. Moreover,epsilonmust be at least 2^-50.Refer to this doc for more information.
- Specified by:
computeConfidenceIntervalin interfaceNoise
-
computeQuantile
public double computeQuantile(double rank, double x, int l0Sensitivity, double lInfSensitivity, double epsilon, @Nullable java.lang.Double delta)Computes the quantile z satisfying Pr[Y <= z] =rankfor a Laplace random variable Y with meanxand variance according to the specified privacy parameters.- Specified by:
computeQuantilein interfaceNoise
-
-