Class GaussianNoise
- java.lang.Object
-
- com.google.privacy.differentialprivacy.GaussianNoise
-
- All Implemented Interfaces:
Noise
public class GaussianNoise extends java.lang.Object implements Noise
Generates and adds Gaussian noise to a raw piece of numerical data such that the result is securely differentially private.The Gaussian noise is generated according to the binomial sampling mechanism described here. This approach is robust against unintentional privacy leaks due to artifacts of floating point arithmetic.
-
-
Constructor Summary
Constructors Constructor Description GaussianNoise()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, int l0Sensitivity, double lInfSensitivity, double epsilon, java.lang.Double delta)Adds Gaussian noise toxsuch that the output is(epsilon, delta)-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 Gaussian noise to the integerxsuch that the output is(epsilon, delta)-differentially private, with respect to the specified L_0 and L_inf sensitivities.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 Gaussian 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, java.lang.Double delta)Adds Gaussian noise toxsuch that the output is(epsilon, delta)-differentially private, with respect to the specified L_0 and L_inf sensitivities.
-
addNoise
public long addNoise(long x, int l0Sensitivity, long lInfSensitivity, double epsilon, @Nullable java.lang.Double delta)Adds Gaussian noise to the integerxsuch that the output is(epsilon, delta)-differentially private, with respect to the specified L_0 and L_inf sensitivities.
-
getMechanismType
public com.google.differentialprivacy.SummaryOuterClass.MechanismType getMechanismType()
- Specified by:
getMechanismTypein interfaceNoise
-
computeConfidenceInterval
public ConfidenceInterval computeConfidenceInterval(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.Refer to this doc for more information.
- Specified by:
computeConfidenceIntervalin interfaceNoise
-
computeConfidenceInterval
public ConfidenceInterval computeConfidenceInterval(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.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 Gaussian random variable Y with meanxand variance according to the specified privacy parameters.- Specified by:
computeQuantilein interfaceNoise
-
-