Description Usage Arguments Value Examples
View source: R/cluster-classifier.R
Given an n x m matrix of centroids, where m are the prototypic centroids with n features, classify new samples according to the distance to the centroids.
1 | cluster_classify(data, centroid, method = "pearson")
|
data |
a |
centroid |
a |
method |
Character string indicating which method to use to calculate
distance to centroid. Options are |
Returns a numeric vector of length p with the class assigned to each sample according to the shortest distance to centroid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # load example dataset
require(iC10TrainingData)
require(pamr)
data(train.Exp)
data(IntClustMemb)
TrainData <- list(x = train.Exp, y = IntClustMemb)
# Create prototypic centroids
pam <- pamr.train(TrainData)
centroids <- pam$centroids
Class <- cluster_classify(train.Exp, centroids)
table(Class, IntClustMemb)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.