fast.sil {CircularSilhouette} | R Documentation |
Calculating Silhouette on Linear Data Clusters
Description
A fast linear-time algorithm to calculate silhouette information on one-dimensional data with cluster labels.
Usage
fast.sil(x, cluster)
Arguments
x |
a numeric vector of one-dimensional points |
cluster |
an integer vector of cluster labels for each point |
Details
The silhouette information on one-dimensional data is
calculated in linear time here, instead of quadratic time by
definition. There is an overhead of sorting O(n \log n)
if the
input data are not sorted.
Value
The function returns a numeric value of the average silhouette information calculated on the input data clusters.
Examples
x <- c(-1.2, -2, -3, -2.5, 1, 0.8, 1.5, 1.2)
cluster <- c(1, 1, 1, 1, 2, 2, 2, 2)
fast.sil(x, cluster)
[Package CircularSilhouette version 0.0.1 Index]