I have a question about the kkmeans
function in the kernlab
package of R. I am new to this package and please forgive me if I'm missing something obvious here.
I would like to assign a new data point to a cluster in a set of clusters that were created using kernel k-means with the function 'kkmeans'. With regular clustering, one would do this by calculating the Euclidian distance between the new data point and the cluster centroids, and choose the cluster with the closest centroid. In kernel k-means, one must do this in the feature space.
Take the example used in the kkmeans description:
data(iris)
sc <- kkmeans(as.matrix(iris[,-5]), centers=3)
Say that I have a new data point here, which I would like to assign to the closest cluster created above in sc
.
Sepal.Length Sepal.Width Petal.Length Petal.Width
5.0 3.6 1.2 0.4
Any tips on how to do this? Your help is very appreciated.