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 | |
|
plot_02_hard_vs_fuzzy.py |
Hard versus fuzzy partitions: k-means, k-medoids, and FCM | |
|
plot_03_gk_ellipses.py |
Gustafson–Kessel: clusters with their own shape | |
|
plot_04_gg_densities.py |
Gath–Geva: clusters of different size and density | |
|
plot_05_validity_scan.py |
Choosing the number of clusters with validity indices | |
|
plot_06_predict_new_data.py |
Applying a fitted model to new data | |
|
plot_07_motorcycle_scaling.py |
Feature scaling on real data: the motorcycle data set | |
|
plot_08_sklearn_pandas_workflow.py |
Working with pandas and scikit-learn: pipelines, DataFrames, and model selection | |
|
plot_09_fuzziness_exponent.py |
The fuzziness exponent m: from crisp cells to uniform memberships | |
|
plot_10_initialisation_restarts.py |
Local optima and restarts: initializing Gustafson–Kessel on crossing lines | |
|
plot_11_distance_norms.py |
Distance norms: Euclidean, diagonal, and Mahalanobis fuzzy c-means | |
|
plot_12_fuzzifiers_annealing.py |
What makes a partition fuzzy: fuzzifiers, regularization, and annealing | |
|
plot_13_subtractive_clustering.py |
Subtractive clustering: the number and location of clusters from density | |
|
plot_14_merging_stability.py |
Three routes to the number of clusters: merging, validity scan, and stability | |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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 | |
|
plot_02_fuzzy_sammon.py |
Fuzzy Sammon mapping: projecting clusters, not just data | |
|
plot_03_fuzzy_som.py |
Fuzzy self-organizing map: ordered prototypes by regularized FCM | |
|
plot_04_cluster_number_validation.py |
Visual validation of the number of clusters with FUZZSAM | |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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 | |
|
plot_02_ts_dynamic_plant.py |
Identification of a nonlinear dynamic system with free-run validation | |
|
plot_03_ts_mimo.py |
MIMO Takagi–Sugeno model with local MIMO ARX consequents | |
|
plot_04_fcrm_switching.py |
Fuzzy c-regression models: switching regression with crossing lines | |
|
plot_05_supervised_classifier.py |
Supervised fuzzy clustering: classifier rules that carry class probabilities | |
|
plot_06_fuzzy_partition_tree.py |
Supervised fuzzy partitions as a priori discretization for decision trees | |
|
plot_07_hinging_tree.py |
Hinging-hyperplane regression tree identified by fuzzy c-regression | |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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 | |
|
plot_02_bottom_up_vs_fuzzy.py |
Bottom-up segmentation with PCA models versus fuzzy segmentation | |
|
plot_03_fnn_model_order.py |
Model-order selection by false nearest neighbors with a cluster-based threshold | |
|
plot_04_chaotic_reconstruction.py |
State-space reconstruction and prediction of a chaotic time series | |
|
plot_05_mixed_input_structure.py |
Model-free structure selection with mixed discrete and continuous inputs | |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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 | |
|
plot_02_mst_cut_criteria.py |
Inconsistent edges: Zahn’s criteria and the neighborhood depth | |
|
plot_03_mst_validation.py |
Number of clusters: volume-based validity and fuzzy cluster similarity | |
|
plot_04_geodesic_fcm.py |
Geodesic-distance-based fuzzy clustering versus fuzzy c-means | |
|
plot_05_geodesic_path_isomap.py |
Geodesic paths, the S-curve, and clustering of the Isomap projection | |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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 | |
|
plot_02_pfcm_trade_off.py |
Possibilistic fuzzy c-means: memberships and typicalities together | |
|
plot_03_noise_clustering.py |
Noise clustering: a virtual cluster at constant distance | |
|
plot_04_kernel_fcm.py |
Kernel fuzzy c-means: rings and moons through the kernel trick | |
|
plot_05_fuzzy_c_varieties.py |
Fuzzy c-varieties: lines as prototypes, and the elliptotype compromise | |
|
plot_06_fuzzy_c_shells.py |
Fuzzy c-shells: circles as prototypes | |
|
plot_07_feature_weighting.py |
Learning which features matter: SCAD and the weighted FCM | |
|
plot_08_volume_prototypes.py |
Volume prototypes and adaptive cluster merging | |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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 | |
|
plot_02_fcmdd_dtw_series.py |
Fuzzy c-medoids on dynamic-time-warping dissimilarities of time series | |
|
plot_03_kmodes_survey.py |
Fuzzy k-modes on categorical survey data | |
|
plot_04_kprototypes_mixed.py |
Fuzzy k-prototypes on mixed numeric and categorical data | |
|
plot_05_gower_fcmdd_vs_onehot.py |
Gower’s dissimilarity versus one-hot encoding for mixed data | |
|
plot_06_autocorrelation_series.py |
Autocorrelation-based fuzzy clustering of time series | |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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 | |
|
plot_02_ocs_imputation.py |
Imputation by clustering: accuracy of the completed values | |
|
plot_03_large_data.py |
Fuzzy c-means for very large data: rseFCM, spFCM and oFCM | |
|
plot_04_stream_drift.py |
Clustering a drifting stream chunk by chunk with partial_fit | |
|
plot_05_image_noise.py |
Image segmentation under noise: six spatially constrained FCM variants | |
|
plot_06_spatial_alpha_window.py |
Spatial FCM: the neighborhood weight and the window size | |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
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 | |
|
plot_02_pcca_pairwise_constraints.py |
Pairwise constraints: must-link, cannot-link and competitive agglomeration | |
|
plot_03_fccm_document_term.py |
Fuzzy co-clustering of a document–term matrix | |
|
plot_04_collaborative_sites.py |
Collaborative fuzzy clustering across three data sites | |
|
plot_05_ensemble_consensus.py |
Consensus of soft clusterings: a library beats a single run | |
|
plot_06_ensemble_lifetime.py |
The lifetime criterion of evidence accumulation | |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||