Learn R Programming

daltoolbox (version 1.3.767)

cluster_pam: PAM (Partitioning Around Medoids)

Description

Clustering around representative data points (medoids) using cluster::pam.

Usage

cluster_pam(k = 1)

Value

returns PAM object.

Arguments

k

the number of clusters to generate.

Details

More robust to outliers than k‑means. The intrinsic metric reported is the within‑cluster SSE to medoids.

The base clusterer() uses wcss as a generic default, but cluster_pam() specializes that choice because PAM is commonly compared through partition quality indices that balance cohesion and separation.

Default evaluation in cluster_pam() is:

  • main metric: metric_silhouette()

  • internal evaluation: silhouette, davies_bouldin, calinski_harabasz

  • external evaluation: entropy, purity, adjusted_rand_index

The generic wcss fallback is not used as the main metric because PAM is not optimized around centroids and is usually interpreted through medoid-based partition quality rather than only through within-cluster dispersion.

References

Kaufman, L. and Rousseeuw, P. J. (1990). Finding Groups in Data: An Introduction to Cluster Analysis. Rousseeuw, P. J. (1987). Silhouettes: A graphical aid to the interpretation and validation of cluster analysis. Davies, D. L., & Bouldin, D. W. (1979). A cluster separation measure. Calinski, T., & Harabasz, J. (1974). A dendrite method for cluster analysis.

Examples

Run this code
# setup clustering
model <- cluster_pam(k = 3)

#load dataset
data(iris)

# build model
model <- fit(model, iris[,1:4])
clu <- cluster(model, iris[,1:4])
table(clu)

# evaluate model using external metric
eval <- evaluate(model, clu, iris$Species)
eval

Run the code above in your browser using DataLab