surfaceanalysisdp_mean
Analysisscalar · returns json

DP_MEAN

Differentially-private mean (Laplace mechanism)

Per-row — runs once for each row.

analysisdeterministicjson

Arguments

nametypedescription
valuesJSON
epsilon(optional)DOUBLE
sensitivity(optional)DOUBLE

About

Differentially-private mean via the Laplace mechanism. Takes a numeric array and a privacy budget ε (epsilon), returns a noised mean that satisfies ε-differential privacy under the assumption that each row contributes at most `sensitivity` units to the total. The noise is drawn from Laplace(scale = sensitivity / (epsilon * n)), which matches the formal DP guarantee for the mean aggregate with known bounds on the per-row value. For binary / rate metrics set sensitivity = 1.0 (default). For bounded continuous values set sensitivity to the width of the allowed range (e.g., 100 for a 0-100 percentage). Usage: -- DP mean tenure with ε=1.0 (strong privacy) and sensitivity=365 days SELECT dp_mean( ARRAY_AGG(tenure_days), epsilon => 1.0, sensitivity => 365.0 ) AS private_avg_tenure FROM customers; With GROUP BY, you get one DP aggregate per group: SELECT plan_tier, dp_mean(ARRAY_AGG(age), 1.0, 100.0) AS private_avg_age FROM customers GROUP BY plan_tier; Epsilon interpretation: smaller = more privacy, more noise. A value of 1.0 is conservative, 10.0 is permissive, 0.1 is paranoid.

Examples

DP mean with high epsilon = very little noise

SELECT
  dp_mean (
    JSON('[10,20,30,40,50,60,70,80,90,100]'),
    epsilon := 100.0,
    sensitivity := 1.0
  );

Nearby rabbit holes

same domain
Climb back to The Looking Glass