ECM (Evidential C-Means) Documentationο
π Overviewο
ECM is an evidential extension of the classic Fuzzy C-Means algorithm. It is based on the theory of belief functions and produces a credal partition. Each data point can belong to multiple clusters or even be assigned to the ignorance/noise cluster if its assignment is uncertain.
βοΈ Class Definitionο
Class Name: ECM
This class implements the ECM clustering algorithm using mass assignment and credal partitions.
class ECM:
def __init__(self, n_clusters: int = 3, m: float = 2.0, delta: float = 10.0, max_iter: int = 100, tol: float = 1e-5):
...
π Parametersο
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
int |
3 |
Number of clusters |
|
float |
2.0 |
Fuzziness degree |
|
float |
10.0 |
Distance threshold for the noise cluster |
|
int |
100 |
Maximum number of iterations |
|
float |
1e-5 |
Convergence threshold based on centroid changes |
π Usage Examplesο
from soft_clustering._ecm._ecm import ECM
import numpy as np
X = np.array([
[1.0, 2.0],
[1.5, 1.8],
[5.0, 8.0],
[8.0, 8.0],
[1.0, 0.6],
[9.0, 11.0]
])
model = ECM(n_clusters=2, m=2.0, delta=5.0, max_iter=100)
model.fit(X)
mass = model.get_membership()
print("Mass matrix:")
print(mass)
π₯ Input / π€ Outputο
Input to
fit(X):X (np.ndarray): Input data (N x D)
Returns:
Mass matrix (N x K+1), where the last column is for the noise cluster
π οΈ Methodsο
fit(X): Runs the ECM algorithm and updates prototypes and mass matrixget_membership(): Returns the learned mass matrix including noise cluster
π Implementation Notesο
Mass values are normalized for each sample
A noise cluster is modeled using a fixed distance
deltaMemberships are expressed as belief degrees, not just probabilities
π Referenceο
This implementation is based on:
βECM: An Evidential Version of the Fuzzy C-Means Algorithmβ
by T. Denoeux, M. Masson (2004).