Skip to content
Prev 42775 / 398506 Next

Using pam, agnes or clara as prediction models?

On Wed, Jan 14, 2004 at 03:18:10PM -0500, Liaw, Andy wrote:
Thanks very much for your quick answer! I've tried your suggestion in
the following way:

 # separate the ruspini data into train and test set
 > train<-ruspini[1:50,]
 > test<-ruspini[51:75,]
 > pamx<-pam(train,4)
 > knnx<-knn(pamx$medoids,test,factor(c("a","b","c","d")),k=3)
 > knnx
 [1] d d b b d c b c c d c a a d c c a a c a a d c d a
 Levels: a b c d

But the result of applying the test set to the knn should only contain 2
clusters, since the upper half of the ruspini data contains only 2
clusters.

Could you tell me what I am missing here?

Regards,

Renald