Predicting Values with k-Means Clustering Algorithm?

If you are considering assigning a value based on the average value within the nearest cluster, you are talking about some form of "soft decoder", which estimates not only the correct value of the coordinate but your level of confidence in the estimate. The alternative would be a "hard decoder" where only values of 0 and 1 are legal (occur in the training data set), and the new coordinate would get the median of the values within the nearest cluster. My guess is that you should always assign only a known-valid class value (0 or 1) to each coordinate, and averaging class values is not a valid approach.

Thanks, that's very helpful! – DizzyDoo Nov 19 at 12:41.

To assign a new data point to one of a set of clusters created by k-means, you just find the centroid nearest to that point. In other words, the same steps you used for the iterative assignment of each point in your original data set to one of k clusters. The only difference here is that the centroids you are using for this computation is the final set--i.e.

, the values for the centroids at the last iteration. Here's one implementation in python (w/ NumPy): >>> import numpy as NP >>> # just made up values--based on your spec (2D data + 2 clusters) >>> centroids array(54, 85, 99, 78) >>> # randomly generate a new data point within the problem domain: >>> new_data = NP. Array(67, 78) >>> # to assign a new data point to a cluster ID, >>> # find its closest centroid: >>> diff = centroids - new_data0,: # NumPy broadcasting >>> diff array(-13, 7, 32, 0) >>> dist = NP.

Sqrt(NP. Sum(diff**2, axis=-1)) # Euclidean distance >>> dist array( 14.76, 32. ) >>> closest_centroid = centroidsNP.

Argmin(dist), >>> closest_centroid array(54, 85).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions