Skip to contents

s(i) = (b(i) - a(i)) / max(a(i), b(i)); a(i) mean distance to own cluster (self excluded), b(i) smallest mean distance to any other cluster. Singleton clusters score 0 by convention.

Usage

morie_geron_silhouette(X, labels, metric = "euclidean")

Arguments

X

Data (n, d), n >= 2.

labels

Cluster assignment per row.

metric

"euclidean" or "manhattan".

Value

list with silhouette, samples, a, b, cluster_means, n_clusters, estimate, n, method.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_silhouette(V, V)
#> $silhouette
#> [1] 0
#> 
#> $samples
#> [1] 0 0 0 0 0 0 0 0
#> 
#> $a
#> [1] 0 0 0 0 0 0 0 0
#> 
#> $b
#> [1] 1 1 1 1 1 1 1 1
#> 
#> $cluster_means
#> 1 2 3 4 5 6 7 8 
#> 0 0 0 0 0 0 0 0 
#> 
#> $n_clusters
#> [1] 8
#> 
#> $estimate
#> [1] 0
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Silhouette coefficient with euclidean distances (self excluded from cohesion)"
#>