add laplace to k means

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

add laplace to k means


I have used this k means code on Flink

and I would to add noise that follows Laplace distribution to the sum of
data item and to the number to data item when calculate a new cluster center
in each iteration .

for j=1 ---> p do
u' = (sum +Lap(ε))/(num+Laplace(ε))

I have already write Laplace function , but i don't Know how to add it in k
means code and in which line i should write it .

Thank you

Sent from:
Reply | Threaded
Open this post in threaded view

Re: add laplace to k means

Yun Gao
Hi alaa, 

    In the KMeans example, in each iteration the new centers is computed in a map-reduce pattern. Each task maintains a part of points and it first choose the new center for each point, and then the new center of the sum(point) and num(point) is computed in the CentroidAccumulator, and the new point is then computed in CentroidAverager by sum(point) / num(point).  Therefore, I think you may change the implementation of  CentroidAverager to add the noise.


From:alaa <[hidden email]>
Send Time:2019 Jul. 23 (Tue.) 21:06
To:user <[hidden email]>
Subject:add laplace to k means


I have used this k means code on Flink

and I would to add noise that follows Laplace distribution to the sum of
data item and to the number to data item when calculate a new cluster center
in each iteration .

for j=1 ---> p do 
u' = (sum +Lap(ε))/(num+Laplace(ε))

I have already write Laplace function , but i don't Know how to add it in k
means code and in which line i should write it .

Thank you

Sent from: