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.

Best, 
Yun



------------------------------------------------------------------
From:alaa <alaa.abut...@hotmail.com>
Send Time:2019 Jul. 23 (Tue.) 21:06
To:user <user@flink.apache.org>
Subject:add laplace to k means

Hallo 

I have used this k means code on Flink 

https://github.com/apache/flink/blob/master/flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/clustering/KMeans.java

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: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/

Reply via email to