View source: R/linear_silhouette.R
fast.sil | R Documentation |
A fast linear-time algorithm to calculate silhouette information on one-dimensional data with cluster labels.
fast.sil(x, cluster)
x |
a numeric vector of one-dimensional points |
cluster |
an integer vector of cluster labels for each point |
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.
The function returns a numeric value of the average silhouette information calculated on the input data clusters.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.