Fuzzy C Means#
A distance-based soft-clustering algorithm that allows samples to belong to multiple clusters if they fall within a fuzzy region controlled by the fuzz hyper-parameter. Like K Means, Fuzzy C Means minimizes the inertia cost function, however, unlike K Means, FCM uses a batch solver that requires the entire training set to compute the update to the cluster centroids at each step. Inertia is defined as the average of the fuzzy objective function Σᵢ Σₖ uᵢₖᵐ ‖xᵢ - cₖ‖² where uᵢₖ is the membership of sample i in cluster k and m is the fuzz factor.
Interfaces: Estimator, Learner, Probabilistic, Verbose, Persistable
Data Type Compatibility: Continuous
Parameters#
| # | Name | Default | Type | Description |
|---|---|---|---|---|
| 1 | c | int | The number of target clusters. | |
| 2 | fuzz | 2.0 | float | Determines the bandwidth of the fuzzy area. |
| 3 | epochs | 300 | int | The maximum number of training rounds to execute. |
| 4 | minChange | 1e-4 | float | The minimum change in the inertia for the algorithm to continue training. |
| 5 | kernel | Euclidean | Distance | The distance kernel used to compute the distance between sample points. |
| 6 | seeder | PlusPlus | Seeder | The seeder used to initialize the cluster centroids. |
Example#
use Rubix\ML\Clusterers\FuzzyCMeans;
use Rubix\ML\Kernels\Distance\Euclidean;
use Rubix\ML\Clusterers\Seeders\Random;
$estimator = new FuzzyCMeans(5, 1.2, 400, 1.0, new Euclidean(), new Random());
Additional Methods#
Return the c computed centroids of the training set.
public centroids() : array[]
Returns the inertia at each epoch from the last round of training. The inertia decreases monotonically with each epoch until the algorithm converges.
public losses() : float[]|null
Return the progress table combining every epoch recorded during the last training session — the inertia at each epoch — into a single ordered sequence.
public progress() : iterable
References#
-
J. C. Bezdek et al. (1984). FCM: The Fuzzy C-Means Clustering Algorithm. ↩