predict.clus {cubt}R Documentation

predict.clus ~~function to do ... ~~

Description

Predict for specific clusters obtained from a learning sample, the cluster of each observation from the test sample

Usage

predict.clus = function(cluster, dat_app, dat_test, met = "im") 

Arguments

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"

Details

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.

Value

The cluster assigned to each observation from the test sample.

Examples

 aaa = na.omit(airquality)
 app = aaa[1:80,]
 tst = aaa[90:111,]
 ooo = kmeans(app,3)$cluster
 toto = predict.clus(ooo,app,tst,"euclidian")

#





[Package cubt version 3.2 Index]