Prototypes of groups.
Prototypes are ‘representative’ cases of a group of data points, given
the similarity matrix among the points. They are very similar to
medoids. The function is named ‘classCenter’ to avoid conflict with
prototype in the
a matrix or data frame
group labels of the rows in
the proximity (or similarity) matrix, assumed to be
symmetric with 1 on the diagonal and in [0, 1] off the diagonal (the
order of row/column must match that of
number of nearest neighbors used to find the prototypes.
This version only computes one prototype per class. For each case in
nNbr nearest neighors are found. Then, for each
class, the case that has most neighbors of that class is identified.
The prototype for that class is then the medoid of these neighbors
(coordinate-wise medians for numerical variables and modes for
This version only computes one prototype per class. In the future more prototypes may be computed (by removing the ‘neighbors’ used, then iterate).
A data frame containing one prototype in each row.
1 2 3 4 5 6 7
data(iris) iris.rf <- RRF(iris[,-5], iris[,5], prox=TRUE) iris.p <- classCenter(iris[,-5], iris[,5], iris.rf$prox) plot(iris[,3], iris[,4], pch=21, xlab=names(iris), ylab=names(iris), bg=c("red", "blue", "green")[as.numeric(factor(iris$Species))], main="Iris Data with Prototypes") points(iris.p[,3], iris.p[,4], pch=21, cex=2, bg=c("red", "blue", "green"))
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.