circular.sil: Calculating Silhouette on Circular Data Clusters

View source: R/circular_silhouette.R

circular.silR Documentation

Calculating Silhouette on Circular Data Clusters

Description

A fast linear-time algorithm to calculate silhouette information on circular data with cluster labels.

Usage

circular.sil(O, cluster, Circumference, method = c("linear", "quadratic"))

Arguments

O

a numeric vector of circular data points

cluster

an integer vector of cluster labels for each point

Circumference

a numeric value giving the circumference of the circle

method

a character value to specify the algorithm to calculate the silhouette information. The default value is "linear", indicating a fast linear time algorithm for calculating circular silhouette. The option of "quadratic" is provided for testing and comparison, not meant for production use.

Details

If method takes the value of "linear" (default), the silhouette information on circular data is calculated by a fast linear-time algorithm; if method is "quadratic", a quadratic-time algorithm is used instead to calculate silhouette by definition. There is an overhead of sorting O(n log n) if the input data are not sorted.

One important assumption is that a cluster cannot be contained in another cluster in the input cluster labels.

Value

The function returns a numeric value of the average silhouette information calculated on the input circular data clusters.

Examples

O <- c(-1.2, -2, -3, -2.5, 1, 0.8, 1.5, 1.2)
cluster <- c(1, 1, 1, 1, 2, 2, 2, 2)
circular.sil(O, cluster, 3)


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