cluster_cmeans: Fuzzy c-means

View source: R/clu_cmeans.R

cluster_cmeansR Documentation

Fuzzy c-means

Description

Fuzzy c-means clustering.

Usage

cluster_cmeans(
  centers = 2,
  m = 2,
  iter = 100,
  dist = "euclidean",
  tol = 1e-06,
  nstart = 1,
  seed = NULL
)

Arguments

centers

number of clusters

m

fuzziness parameter (m > 1)

iter

maximum number of iterations

dist

distance method: "euclidean" or "manhattan"

tol

convergence tolerance on the membership change

nstart

number of restarts; the lowest-error run is kept (default 1)

seed

optional seed for reproducibility

Details

Produces soft membership for each cluster. The hard assignment is returned by cluster(). Membership degrees are returned in the membership attribute. The algorithm alternates between updating cluster centers as membership-weighted means and recomputing memberships from the distances to those centers, until convergence. With nstart > 1 it runs several times from different random starts and keeps the run with the lowest within-cluster fuzzy error, reducing sensitivity to the random start.

The base clusterer() uses wcss as a generic default, but cluster_cmeans() specializes that choice because fuzzy clustering carries both a hard partition view and a soft membership structure.

Default evaluation in cluster_cmeans() is:

  • main metric: metric_silhouette()

  • internal evaluation: silhouette, withinerror

  • external evaluation: entropy, purity, adjusted_rand_index

The generic wcss fallback is not used as the main metric because fuzzy c-means is better summarized by a partition quality index plus a criterion that respects the model's own within-cluster objective.

Value

returns a fuzzy clustering object.

References

Bezdek, J. C. (1981). Pattern Recognition with Fuzzy Objective Function Algorithms. Dunn, J. C. (1973). A Fuzzy Relative of the ISODATA Process and Its Use in Detecting Compact Well-Separated Clusters. Rousseeuw, P. J. (1987). Silhouettes: A graphical aid to the interpretation and validation of cluster analysis.

Examples

data(iris)
model <- cluster_cmeans(centers = 3, m = 2)
model <- fit(model, iris[,1:4])
clu <- cluster(model, iris[,1:4])
table(clu)

daltoolbox documentation built on Nov. 23, 2026, 9:08 a.m.