surfaceanalysisdp_count
Analysisscalar · returns json

DP_COUNT

Differentially-private count (Laplace mechanism, sensitivity=1)

Per-row — runs once for each row.

analysisdeterministicjson

Arguments

nametypedescription
valuesJSON
epsilon(optional)DOUBLE

About

Differentially-private count via the Laplace mechanism. Useful for "how many users did X" reporting where you need to publish aggregate statistics without leaking whether any individual user was in the cohort. The per-row sensitivity of count is always 1, so the only knob is ε. Returns a noised count: noisy_count = true_count + Laplace(1.0 / epsilon) Usage: -- How many customers converted, with DP? SELECT dp_count(ARRAY_AGG(converted), epsilon => 1.0) AS private_conversions FROM experiment_log WHERE variant = 'B'; Smaller ε = more noise (and more privacy). ε = 1.0 is a reasonable starting point; ε = 0.1 is paranoid; ε = 10.0 is permissive.

Examples

DP count with high epsilon = close to true count

SELECT
  dp_count (JSON('[1,1,1,0,1,0,1,1,1,0]'), epsilon := 100.0);

Nearby rabbit holes

same domain
Climb back to The Looking Glass