Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Laplace Mechanism | Differential Privacy Mechanisms
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Data Privacy and Differential Privacy Fundamentals

bookLaplace Mechanism

The Laplace mechanism is one of the foundational tools in differential privacy. It is designed to protect individual privacy by adding carefully calibrated random noise to the output of a function or query. This mechanism is particularly useful when you want to release numeric results, such as counts or sums, while ensuring that the presence or absence of a single individual in the dataset does not significantly affect the output.

The key idea behind the Laplace mechanism is to add noise drawn from the Laplace distribution, which is centered at zero and has a scale parameter determined by the function’s global sensitivity and the desired privacy level, denoted by epsilon (ε). The global sensitivity measures the maximum amount that a single individual's data can change the result of the query. The Laplace mechanism ensures ε-differential privacy by adding noise proportional to this sensitivity.

The formula for the Laplace mechanism is:

Release:f(D)+Lap(S/ε)Release: f(D) + Lap(S/ε)

where:

  • f(D)f(D) is the true query result on dataset DD;
  • Lap(S/ε)Lap(S/ε) means noise is drawn from the Laplace distribution with scale S/εS/ε;
  • SS is the global sensitivity of the function;
  • εε is the privacy parameter (smaller ε means more privacy, but also more noise).

You use the Laplace mechanism when you need to release aggregate statistics, such as counts or sums, and want strong privacy guarantees for each individual in your dataset. It is especially suitable for queries with bounded sensitivity and when you require pure differential privacy (i.e., delta equals zero).

12345678910111213141516171819202122232425
import numpy as np from scipy.stats import laplace # Example: Adding Laplace noise to a count query # True count result (e.g., number of users with a certain attribute) true_count = 42 # Privacy parameter epsilon epsilon = 1.0 # Global sensitivity for count queries is 1 sensitivity = 1 # Scale parameter for Laplace distribution scale = sensitivity / epsilon # Draw Laplace noise noise = np.random.laplace(loc=0, scale=scale) # Noisy count (differentially private result) noisy_count = true_count + noise print("True count:", true_count) print("Noisy count (with Laplace noise):", noisy_count)
copy
Note
Study More

The Laplace mechanism is typically used when you require pure differential privacy, and your query's sensitivity is well understood and bounded. The Gaussian mechanism, by contrast, is often used when you can tolerate a small probability of greater privacy loss (approximate differential privacy) or when the query has higher sensitivity. To decide between Laplace and Gaussian, consider your privacy parameters, the required privacy guarantee, and the characteristics of your data and queries.

1. Which property does the Laplace mechanism guarantee when adding noise to a query result?

2. How does increasing the global sensitivity of a query affect the amount of Laplace noise added?

question mark

Which property does the Laplace mechanism guarantee when adding noise to a query result?

Select the correct answer

question mark

How does increasing the global sensitivity of a query affect the amount of Laplace noise added?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 2

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

bookLaplace Mechanism

Swipe um das Menü anzuzeigen

The Laplace mechanism is one of the foundational tools in differential privacy. It is designed to protect individual privacy by adding carefully calibrated random noise to the output of a function or query. This mechanism is particularly useful when you want to release numeric results, such as counts or sums, while ensuring that the presence or absence of a single individual in the dataset does not significantly affect the output.

The key idea behind the Laplace mechanism is to add noise drawn from the Laplace distribution, which is centered at zero and has a scale parameter determined by the function’s global sensitivity and the desired privacy level, denoted by epsilon (ε). The global sensitivity measures the maximum amount that a single individual's data can change the result of the query. The Laplace mechanism ensures ε-differential privacy by adding noise proportional to this sensitivity.

The formula for the Laplace mechanism is:

Release:f(D)+Lap(S/ε)Release: f(D) + Lap(S/ε)

where:

  • f(D)f(D) is the true query result on dataset DD;
  • Lap(S/ε)Lap(S/ε) means noise is drawn from the Laplace distribution with scale S/εS/ε;
  • SS is the global sensitivity of the function;
  • εε is the privacy parameter (smaller ε means more privacy, but also more noise).

You use the Laplace mechanism when you need to release aggregate statistics, such as counts or sums, and want strong privacy guarantees for each individual in your dataset. It is especially suitable for queries with bounded sensitivity and when you require pure differential privacy (i.e., delta equals zero).

12345678910111213141516171819202122232425
import numpy as np from scipy.stats import laplace # Example: Adding Laplace noise to a count query # True count result (e.g., number of users with a certain attribute) true_count = 42 # Privacy parameter epsilon epsilon = 1.0 # Global sensitivity for count queries is 1 sensitivity = 1 # Scale parameter for Laplace distribution scale = sensitivity / epsilon # Draw Laplace noise noise = np.random.laplace(loc=0, scale=scale) # Noisy count (differentially private result) noisy_count = true_count + noise print("True count:", true_count) print("Noisy count (with Laplace noise):", noisy_count)
copy
Note
Study More

The Laplace mechanism is typically used when you require pure differential privacy, and your query's sensitivity is well understood and bounded. The Gaussian mechanism, by contrast, is often used when you can tolerate a small probability of greater privacy loss (approximate differential privacy) or when the query has higher sensitivity. To decide between Laplace and Gaussian, consider your privacy parameters, the required privacy guarantee, and the characteristics of your data and queries.

1. Which property does the Laplace mechanism guarantee when adding noise to a query result?

2. How does increasing the global sensitivity of a query affect the amount of Laplace noise added?

question mark

Which property does the Laplace mechanism guarantee when adding noise to a query result?

Select the correct answer

question mark

How does increasing the global sensitivity of a query affect the amount of Laplace noise added?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 2
some-alt