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:
- choose one row of
points, and all the rows of
- Divide all the data by their column total sum
- calculate the Euclidean Distance between the row and each row of
- choose the smallest distance
- attach the label of the smallest distance
- repeat for the second row ... till the end of
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?
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.