Main Content


FCM clustering options

Since R2023a


    Use an fcmOptions object to specify options for clustering data using the fcm function. You can specify options such as the number of clusters, the clustering exponent, and the distance metric.




    opt = fcmOptions returns a default option object for FCM clustering.

    opt = fcmOptions(Name=Value) specifies options using one or more name-value pair arguments. For example, to compute three clusters, use NumClusters=3.


    expand all

    Number of clusters to create, C, specified as one of the following:

    • "auto" — Cluster the data ten times (C = 2 through 11).

    • Integer greater than 1 — Cluster the data once using the specified number of clusters.

    • Vector of integers greater than 1 — Cluster the data multiple times, once for each value in NumClusters.

    When NumClusters is "auto" or a vector, the fcm function returns cluster centers for the optimal number of clusters, which it determines using a validity index. You can return the clustering results for the other values of C using the info output argument of fcm.

    Exponent for the fuzzy partition matrix, specified as a scalar greater than 1.0. This option controls the amount of fuzzy overlap between clusters, with larger values indicating a greater degree of overlap.

    If your data set is wide with significant overlap between potential clusters, then the calculated cluster centers can be very close to each other. In this case, each data point has approximately the same degree of membership in all clusters. To improve your clustering results, decrease this value, which limits the amount of fuzzy overlap during clustering.

    For an example of fuzzy overlap adjustment, see Adjust Fuzzy Overlap in Fuzzy C-Means Clustering.

    Maximum number of iterations, specified as a positive integer.

    Minimum improvement in objective function between two consecutive iterations, specified as a positive scalar.

    Method for computing distance between data points and cluster centers, specified as one of the following values.

    • "euclidean" — Compute distance using a Euclidean distance metric, which corresponds to the classical FCM algorithm.

    • "mahalanobis" — Compute distance using a Mahalanobis distance metric, which corresponds to the Gustafson-Kessel FCM algorithm.

    • "fmle" — Compute distance using fuzzy maximum likelihood estimation (FMLE), which corresponds to the Gath-Geva FCM algorithm. (since R2023b)

    Since R2023b

    Initial cluster centers, specified as an C-by-N matrix, where C is the number of clusters and N is the number of data features.

    When ClusterCenters is empty, the FCM algorithm randomly initializes the cluster center values.

    Information display flag indicating whether to display the objective function value after each iteration, specified as one of the following values.

    • true — Display objective function.

    • false — Do not display objective function.

    Object Functions

    fcmFuzzy c-means clustering


    collapse all

    Create an fcmOptions object for computing three clusters using a maximum of 200 iterations.

    opt = fcmOptions(...

    You can also specify options using dot notation. For example, disable the command-window output of the objective function value for each FCM iteration.

    opt.Verbose = false;

    Version History

    Introduced in R2023a