# fcmOptions

## Description

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.

## Creation

### Description

returns a default option
object for FCM clustering.`opt`

= fcmOptions

specifies options using one or more name-value pair arguments. For example, to compute
three clusters, use `opt`

= fcmOptions(`Name=Value`

)`NumClusters=3`

.

## Properties

`NumClusters`

— Number of clusters

`"auto"`

(default) | integer greater than `1`

| vector of integers

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`

— Exponent for fuzzy partition matrix

`2.0`

(default) | scalar greater than `1.0`

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.

`MaxNumIteration`

— Maximum number of iterations

`100`

(default) | positive integer

Maximum number of iterations, specified as a positive integer.

`MinImprovement`

— Minimum improvement in objective function

`1e-5`

(default) | positive scalar

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

`DistanceMetric`

— Method for computing distance

`"euclidean"`

(default) | `"mahalanobis"`

| `"fmle"`

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)*

`ClusterCenters`

— Initial cluster centers

`[]`

(default) | matrix

*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.

`Verbose`

— Information display flag

`true`

(default) | `false`

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

`fcm` | Fuzzy c-means clustering |

## Examples

### Specify Options for FCM Clustering

Create an `fcmOptions`

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

opt = fcmOptions(... NumClusters=3,... MaxNumIteration=200);

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**

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)