R: Rock Clustering

predict.rock {cba} | R Documentation

## Rock Clustering

### Description

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

### Usage

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

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

### 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.

### Value

A list with the following components:

`cl` | a factor of cluster memberships of the samples.
`size` | a vector of cluster sizes.

### See Also

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

### Examples

    ### 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)

[Package cba version 0.2-21 Index]