Learn R Programming

kmeans.ddR (version 0.1.0)

predict.dkmeans: distributed predict method for a kmeans model

Description

This function finds cluster label of a set of samples according to a given set of centers specified in the model object.

Usage

"predict"(object, newdata, trace=FALSE, ...)

Arguments

object
an object returned by dkmeans function
newdata
a darray (dense or sparse) or a matrix which contains the samples.
trace
when this argument is true, intermediate steps of the progress are displayed.
...
additional arguments to be passed (None are supported).

Value

This function returns a darray or a matrix based on the type of newdata which contains the corresponding label of each sample.

Details

This function applies the centers found by dkmeans on a new set of samples in order to label them.

Examples

Run this code
 ## Not run: 
#     iris2 <- iris
#     iris2$Species <- NULL
# 
#     library(kmeans.ddR)
# 
#     X <- as.darray(data.matrix(iris2))
# 
#     mykm <- dkmeans(X,centers=3)
# 
#     newdata <- matrix(c(5,4,3,5,7,1,0,8),2,4)
#     labels <- predict(mykm,newdata)
#  ## End(Not run)

Run the code above in your browser using DataLab