1
$\begingroup$

I've posted this question on StackOverflow.

The question asks how to make automatic some steps whom have as goal to find, for each point in a dataset called points, the smallest distance from all the center in centers (a second dataset with centers), and append the center name to the points dataset (clearly the smallest one's).

The procedure is something like this:

  1. choose one row of points, and all the rows of centers
  2. Divide all the data by their column total sum
  3. calculate the Euclidean Distance between the row and each row of centers
  4. choose the smallest distance
  5. attach the label of the smallest distance
  6. repeat for the second row ... till the end of points

Soon is arrived a nice practical answer that I've to test. My question here is something different. This procedure makes me see "some similarity" with a K-Means Clustering Algorithm, but with coordinates fixed.
As stated in one answer, this is a classification, not a clustering (edited the question, of course).
In your opinion, does it exist an algorithm of classification whom decide first the coordinates of the centers (giveth the number of coordinates), instead of the numbers of them like K-Means?

EDIT 1 Everythings works just fine as code, but the Euclidean Distance does not fit well.
Creating a scatterplot with points and centers, some are virtually more near to some centers, but they are put under another label. I'm working on preprocessing the data, or trying another distance.

EDIT 2 Due the nature of the Euclidean distance, having in different scales the numbers, affect the final result, so, till now, as pre processing, I've simply divided the values for their total sum, working on relatives data. I've refreshed the procedure.

$\endgroup$
2
$\begingroup$

This is classification, not clustering!

If you predefine and fix the centers, you are not doing clustering.

What you are looking for is the 1 nearest neighbor classifier.

$\endgroup$
  • $\begingroup$ Thanks a lot, I've learned something new. I've edited the question according to your advice. $\endgroup$ – s_t May 25 '18 at 21:26
  • $\begingroup$ "decide first the coordinates of the centers, instead of the numbers of them" you cannot decide the coordinates without fixing the number of coordinates to fix first. $\endgroup$ – Anony-Mousse May 26 '18 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.