Fuzzy Clustering and Data Analysis in PythonThe fuzzyclust toolbox

Appendix C
The example gallery

Every algorithm of the toolbox has at least one runnable example script. The scripts generate their own data, explain the method in their comments, and end with a study of the main parameters. The same scripts produce the gallery of the online documentation, the Jupyter notebooks, and every computed figure and code listing of this book. The tables below list them by folder of examples/, with the first figure of the book that each script produced.

C.1 Core partitioning algorithms and validity

Folder examples/01_clustering/. The methods are described in chapter 3.

Script

Topic

Figure

plot_01_fcm_basics.py

Fuzzy c-means: memberships and the fuzziness exponent

1.3

   

plot_02_hard_vs_fuzzy.py

Hard versus fuzzy partitions: k-means, k-medoids, and FCM

3.7

   

plot_03_gk_ellipses.py

Gustafson–Kessel: clusters with their own shape

3.8

   

plot_04_gg_densities.py

Gath–Geva: clusters of different size and density

3.12

   

plot_05_validity_scan.py

Choosing the number of clusters with validity indices

4.3

   

plot_06_predict_new_data.py

Applying a fitted model to new data

3.14

   

plot_07_motorcycle_scaling.py

Feature scaling on real data: the motorcycle data set

2.6

   

plot_08_sklearn_pandas_workflow.py

Working with pandas and scikit-learn: pipelines, DataFrames, and model selection

2.8

   

plot_09_fuzziness_exponent.py

The fuzziness exponent m: from crisp cells to uniform memberships

3.5

   

plot_10_initialisation_restarts.py

Local optima and restarts: initializing Gustafson–Kessel on crossing lines

2.7

   

plot_11_distance_norms.py

Distance norms: Euclidean, diagonal, and Mahalanobis fuzzy c-means

2.5

   

plot_12_fuzzifiers_annealing.py

What makes a partition fuzzy: fuzzifiers, regularization, and annealing

3.16

   

plot_13_subtractive_clustering.py

Subtractive clustering: the number and location of clusters from density

3.20

   

plot_14_merging_stability.py

Three routes to the number of clusters: merging, validity scan, and stability

4.4

   

C.2 Visualization of fuzzy clusters

Folder examples/02_visualization/. The methods are described in chapter 5.

Script

Topic

Figure

plot_01_pca_vs_sammon.py

PCA versus Sammon mapping: preserving variance or distances

5.3

   

plot_02_fuzzy_sammon.py

Fuzzy Sammon mapping: projecting clusters, not just data

5.5

   

plot_03_fuzzy_som.py

Fuzzy self-organizing map: ordered prototypes by regularized FCM

5.8

   

plot_04_cluster_number_validation.py

Visual validation of the number of clusters with FUZZSAM

5.14

   

C.3 Model identification

Folder examples/03_models/. The methods are described in chapter 8.

Script

Topic

Figure

plot_01_ts_sinc.py

Takagi–Sugeno model of a static nonlinearity: clusters become rules

8.5

   

plot_02_ts_dynamic_plant.py

Identification of a nonlinear dynamic system with free-run validation

8.9

   

plot_03_ts_mimo.py

MIMO Takagi–Sugeno model with local MIMO ARX consequents

8.14

   

plot_04_fcrm_switching.py

Fuzzy c-regression models: switching regression with crossing lines

8.17

   

plot_05_supervised_classifier.py

Supervised fuzzy clustering: classifier rules that carry class probabilities

8.21

   

plot_06_fuzzy_partition_tree.py

Supervised fuzzy partitions as a priori discretization for decision trees

8.26

   

plot_07_hinging_tree.py

Hinging-hyperplane regression tree identified by fuzzy c-regression

8.29

   

C.4 Time-series analysis

Folder examples/04_timeseries/. The methods are described in chapter 9.

Script

Topic

Figure

plot_01_fuzzy_segmentation.py

Fuzzy segmentation of a multivariate time series

9.4

   

plot_02_bottom_up_vs_fuzzy.py

Bottom-up segmentation with PCA models versus fuzzy segmentation

9.9

   

plot_03_fnn_model_order.py

Model-order selection by false nearest neighbors with a cluster-based threshold

9.11

   

plot_04_chaotic_reconstruction.py

State-space reconstruction and prediction of a chaotic time series

9.16

   

plot_05_mixed_input_structure.py

Model-free structure selection with mixed discrete and continuous inputs

9.21

   

C.5 Graph-based clustering

Folder examples/05_graph/. The methods are described in chapter 7.

Script

Topic

Figure

plot_01_mst_clustering.py

Minimal spanning tree clustering: cutting, splitting, and Gath–Geva refinement

7.3

   

plot_02_mst_cut_criteria.py

Inconsistent edges: Zahn’s criteria and the neighborhood depth

7.7

   

plot_03_mst_validation.py

Number of clusters: volume-based validity and fuzzy cluster similarity

7.10

   

plot_04_geodesic_fcm.py

Geodesic-distance-based fuzzy clustering versus fuzzy c-means

7.13

   

plot_05_geodesic_path_isomap.py

Geodesic paths, the S-curve, and clustering of the Isomap projection

7.17

   

C.6 Possibilistic, noise, kernel, and shape-prototype extensions

Folder examples/06_extensions/. The methods are described in chapter 6.

Script

Topic

Figure

plot_01_pcm_typicality.py

Possibilistic c-means: typicalities, scales and coincident clusters

6.4

   

plot_02_pfcm_trade_off.py

Possibilistic fuzzy c-means: memberships and typicalities together

6.8

   

plot_03_noise_clustering.py

Noise clustering: a virtual cluster at constant distance δ

6.11

   

plot_04_kernel_fcm.py

Kernel fuzzy c-means: rings and moons through the kernel trick

6.15

   

plot_05_fuzzy_c_varieties.py

Fuzzy c-varieties: lines as prototypes, and the elliptotype compromise

6.19

   

plot_06_fuzzy_c_shells.py

Fuzzy c-shells: circles as prototypes

6.22

   

plot_07_feature_weighting.py

Learning which features matter: SCAD and the weighted FCM

6.30

   

plot_08_volume_prototypes.py

Volume prototypes and adaptive cluster merging

6.26

   

C.7 Relational, categorical, and mixed data

Folder examples/07_relational/. The methods are described in chapter 10.

Script

Topic

Figure

plot_01_rfcm_fcm_duality.py

Relational fuzzy c-means and NERF for non-Euclidean data

10.4

   

plot_02_fcmdd_dtw_series.py

Fuzzy c-medoids on dynamic-time-warping dissimilarities of time series

10.7

   

plot_03_kmodes_survey.py

Fuzzy k-modes on categorical survey data

10.12

   

plot_04_kprototypes_mixed.py

Fuzzy k-prototypes on mixed numeric and categorical data

10.16

   

plot_05_gower_fcmdd_vs_onehot.py

Gower’s dissimilarity versus one-hot encoding for mixed data

10.19

   

plot_06_autocorrelation_series.py

Autocorrelation-based fuzzy clustering of time series

10.22

   

C.8 Incomplete, very large, and image data

Folder examples/08_data_realities/. The methods are described in chapter 11.

Script

Topic

Figure

plot_01_missing_strategies.py

Clustering incomplete data: the four strategies of Hathaway and Bezdek

11.4

   

plot_02_ocs_imputation.py

Imputation by clustering: accuracy of the completed values

11.7

   

plot_03_large_data.py

Fuzzy c-means for very large data: rseFCM, spFCM and oFCM

11.10

   

plot_04_stream_drift.py

Clustering a drifting stream chunk by chunk with partial_fit

11.13

   

plot_05_image_noise.py

Image segmentation under noise: six spatially constrained FCM variants

11.16

   

plot_06_spatial_alpha_window.py

Spatial FCM: the neighborhood weight and the window size

11.19

   

C.9 Partial supervision, co-clustering, collaboration, and ensembles

Folder examples/09_beyond_unsupervised/. The methods are described in chapter 12.

Script

Topic

Figure

plot_01_ssfcm_partial_labels.py

Fuzzy c-means with partial supervision: label fraction and weight

12.5

   

plot_02_pcca_pairwise_constraints.py

Pairwise constraints: must-link, cannot-link and competitive agglomeration

12.8

   

plot_03_fccm_document_term.py

Fuzzy co-clustering of a document–term matrix

12.11

   

plot_04_collaborative_sites.py

Collaborative fuzzy clustering across three data sites

12.15

   

plot_05_ensemble_consensus.py

Consensus of soft clusterings: a library beats a single run

12.17

   

plot_06_ensemble_lifetime.py

The lifetime criterion of evidence accumulation

12.20