medinfo {ksharp} | R Documentation |
compute info on distances to medoids/centroids
Description
Analogous in structure to silinfo and neiinfo, it computes a "widths" matrix assessing how well each data point belongs to its cluster. Here, this measure is the ratio of two distances: in the numerator, the distance from the point to the nearest cluster center, and in the denominator, from the point to its own cluster center.
Usage
medinfo(cluster, data, silwidths)
Arguments
cluster |
named vector |
data |
matrix with raw data |
silwidths |
matrix with silhouette widths |
Value
list with component widths. The widths object is a matrix with one row per data item, with column med_ratio holding the sharpness measure.
Examples
# construct a manual clustering of the iris dataset
iris.data = iris[, 1:4]
rownames(iris.data) = paste0("iris_", seq_len(nrow(iris.data)))
iris.dist = dist(iris.data)
iris.clusters = setNames(as.integer(iris$Species), rownames(iris.data))
# compute sharpnessvalues based on medoids
iris.silinfo = silinfo(iris.clusters, iris.dist)
medinfo(iris.clusters, iris.data, iris.silinfo$widths)
[Package ksharp version 0.1.0.1 Index]