# How do I calculate values in K-means (clustering)?

I'm learning some Data Retrieval concepts, one of them being K-means clustering. I understand that it's meant to help understand data, but that's where I begin having issues. I'm working on this problem

and I'm not sure how to approach it. This isn't a "just give me the answer" kind of thing either, I would actually like to know what the variables represent and how I would figure out the answer(s). If someone could explain it in a simple, understandable way, that would be greatly appreciated.

• Here is animation. Keeping it simple - centroids are centers of clusters that constitute it. In your case $k~=~2$, and initial centroids are given. The first step is to assign points into clusters. In the next step you move the centroid to it's optimum - the mean error is the smallest. There are steps like dividing clusters (which will be probably ommited) and moving points to different clusters (I haven't checked if that is the case). Could you watch the video, try to assign points to clusters, recalculate centroids and state the problem? – Evil May 3 '16 at 2:00
• Thank you, that clarified a lot. I would say that (-2,-2): (-4,2),(-2,-1),(1,-1) and (3,3): (3,2). But by what value do you calculate the new position? I know that you add the vectors of the points in the cluster, but what are the values? would it be (-4 + 2 -2 - 1 + 1 - 1) / 6 and (3 + 2) / 2? – Codarus May 3 '16 at 4:13
• I would like to add some thing: there are more k-mean algorithms and it is also very often merged with several other algorithms. The distance calculated depends on the task, but here everything is given, so you need a bit more input on your side, because the picture encodes what to do. Also this site works the best for Q & A, it is not for iterative process, because the comments are for improvements. I am glad I could helped even a bit, but you should edit your question to fit the site rules / format. There are some subparts of your problem that might fit here. – Evil May 3 '16 at 16:34
• So there are some good options: part of your question about K-means might be good Q or you might want to edit and leave the unknowns about K-means, but "please check my answer" is not very good Q. Hint only questions are not disallowed, but to remind - this is Q & A site, not Q & hint. I stretched the rules a bit, also comments are for improving the Q, but the mere hint is not good answer either. It would be nice if you could look at various resources and then improve the Q. And now I do not reply to the results because I feel like you still need to think about it a bit more. – Evil May 3 '16 at 17:07