predict.mediod: predict cluster memberships for new data.

Description Usage Arguments Value Examples

Description

Predict cluster memberships for new data by locating points closest to the mediods of a a clustering procedure. Distance between mediod and newdata is based on the Gower's general similarity coefficient, which applies to mix-type data.

Usage

1
2
## S3 method for class 'mediod'
predict(object, org.data = NULL, newdata, ...)

Arguments

object

object of class mediod. This requires mediod to contain the data matrix of the mediod.

org.data

(optional) the original data used to generate the mediods.

newdata

A new input data frame.

...

Further arguments passed to mix.dist.

Value

clustering for new data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
set.seed(12345)
data(iris)
dat <- iris[, -5]
RF.dist <- RFdist(data=dat, ntree = 10, no.rep=20, syn.type = "permute", 
               importance=FALSE)
# run hclust 
HCmod <- hclust(d=RF.dist$RFdist, method="ward.D2", members= NULL)
clusters <- cutree(HCmod, 3)   
# get mediods of clustering 
 med <- mediod(x = RF.dist$RFdist, clusters=clusters, fun = "sum")
 print(med)
# predict clusters 
pred.clusters <- predict(object= med, org.data = dat, newdata = dat) 
table(clusters, pred.clusters)

## End(Not run)

nguforche/UnsupRF documentation built on May 5, 2019, 4:51 p.m.