fast.sil: Calculating Silhouette on Linear Data Clusters

View source: R/linear_silhouette.R

fast.silR 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)



CircularSilhouette documentation built on April 27, 2022, 9:05 a.m.