Clustering¶
anfis_toolbox.clustering.FuzzyCMeans ¶
FuzzyCMeans(
n_clusters: int,
m: float = 2.0,
max_iter: int = 300,
tol: float = 0.0001,
random_state: int | None = None,
)
Fuzzy C-Means clustering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_clusters
|
int
|
Number of clusters (>= 2). |
required |
m
|
float
|
Fuzzifier (> 1). Default 2.0. |
2.0
|
max_iter
|
int
|
Maximum iterations. |
300
|
tol
|
float
|
Convergence tolerance on centers. |
0.0001
|
random_state
|
int | None
|
Optional seed for reproducibility. |
None
|
Source code in anfis_toolbox/clustering.py
classification_entropy ¶
Classification Entropy (CE). Lower is better (crisper).
Source code in anfis_toolbox/clustering.py
fit ¶
Fit the FCM model.
Sets cluster_centers_ (k,d) and membership_ (n,k).
Source code in anfis_toolbox/clustering.py
fit_predict ¶
partition_coefficient ¶
Bezdek's Partition Coefficient (PC) in [1/k, 1]. Higher is crisper.
Source code in anfis_toolbox/clustering.py
predict ¶
predict_proba ¶
Return membership degrees for samples to clusters (rows sum to 1).
Source code in anfis_toolbox/clustering.py
transform ¶
xie_beni_index ¶
Xie-Beni index (XB). Lower is better.
XB = sum_i sum_k u_ik^m ||x_i - v_k||^2 / (n * min_{p!=q} ||v_p - v_q||^2)