Open MxmUrw opened 2 years ago
me favourite example:
# compute a (epsilon,0)-DP version of the average of a vector
function auto_avg(xs::Vector{<:Real}, bs::NoData(Vector), epsilon::NoData(Real)) :: Priv()
# the query we want to make
clipped_sum(m,b) = fold((x,y) -> x+y, map(x -> clip(x,b,0.), m))
# find suitable clipping parameter using svt
function create_query(b)
m -> clipped_sum(m, b) - clipped_sum(m, b+1)
end
queries = map(create_query, bs)
epsilon_svt = epsilon / 3
at = above_threshold(queries, epsilon_svt, xs, 0)
final_b = bs[at]
# compute noisy sum
epsilon_sum = epsilon / 3
noisy_sum = laplacian_mechanism(final_b, epsilon_sum, clipped_sum(xs, final_b))
# compute noisy number of entries
epsilon_count = epsilon / 3
noisy_count = laplacian_mechanism(1, epsilon_count, length(xs))
noisy_sum/noisy_count
end
sets the input vector bs
to contain consts...
- Vector<n: L1, c: τ_8>[s_4](Real[--])
@ (s_70, ∑∅)
- Vector<n: τ_142, c: τ_59>[s_66](Real[s_9 ©])
@ (∞, ∞)
- τ_281[s_70 ©]
@ (∑∅, ∑∅)
--------------------------
->* Real[--]
The following example cannot be checked because the function f is not polymorphic over the constant value of the argument
y
.