predict.clus {cubt} | R Documentation |
Predict for specific clusters obtained from a learning sample, the cluster of each observation from the test sample
predict.clus = function(cluster, dat_app, dat_test, met = "im")
cluster |
Clusters of each observation in the learning sample |
dat_app |
Learning sample |
dat_test |
Test sample |
met |
The method to use for computing distances, either "im" either "hamming" |
Predict for specific clusters obtained from a learning sample, the cluster of each observation from the test sample. The cluster of a new observation is the nearest one to it among the existing clusters. Distance to a cluster is defined to be the min distance among the distances to all observations to that cluster.
The cluster assigned to each observation from the test sample.
aaa = na.omit(airquality) app = aaa[1:80,] tst = aaa[90:111,] ooo = kmeans(app,3)$cluster toto = predict.clus(ooo,app,tst,"euclidian") #