cba (version 0.2-21)

predict.rock: Rock Clustering

Description

Classify the rows of a data matrix using the Rock classifier.

Usage

# S3 method for rock
predict(object, x, drop = 1, ...)

# S3 method for rock fitted(object, ...)

Value

A list with the following components:

cl

a factor of cluster memberships of the samples.

size

a vector of cluster sizes.

Arguments

object

an object of class rock.

x

a data matrix containing test or new samples.

drop

cluster size threshold.

...

further (unused) arguments.

Details

Provides a wrapper function to the Rock classifier: cluster memberships of the (row) samples are determined by majority vote using the size (of the cluster) weighted number of links.

The classifier uses random tie-breaking and assigns samples with zero link counts to NA. This allows for detection of possible outliers, or interesting patterns.

In the case a drop value greater than zero is specified, all clusters with size equal or less than this value are removed from the classifier. Especially, fitted uses a threshold of one because for singleton clusters the neighborhood is empty.

Note that for the training data the predicted memberships need not necessarily be the same as those obtained from the cluster algorithm.

See Also

rockCluster for obtaining a rock classifier and gknn for k-nearest neighbor classification.

Examples

Run this code
### example from paper
data(Votes)
x <- as.dummy(Votes[-17])
rc <- rockCluster(x, n=2, theta=0.73, debug=TRUE)
rp <- predict(rc, x)
table(rp$cl)

Run the code above in your browser using DataLab