fuzzyclust.relational#

Fuzzy clustering of relational, categorical and mixed data.

The prototype-based algorithms of fuzzyclust.cluster need feature vectors: a mean and a Euclidean distance. This sub-package covers the cases where the objects are not vectors or where the mean makes no sense – only pairwise dissimilarities are known (time series compared by dynamic time warping, documents, graphs), the attributes are categorical, or numeric and categorical attributes are mixed:

The relational estimators follow scikit-learn’s convention: metric="precomputed" makes fit take the square dissimilarity matrix and predict_proba the rectangular matrix of new objects against the training objects; any other metric name computes the matrix from feature vectors.

Relational FCM, NERF c-means, fuzzy c-medoids, fuzzy k-modes and k-prototypes, DTW / autocorrelation / Gower dissimilarities.

Classes#

RelationalFCM([n_clusters, metric, m, tol, ...])

Relational fuzzy c-means (Hathaway, Davenport and Bezdek, 1989).

NERFCM([n_clusters, metric, m, tol, ...])

Non-Euclidean relational fuzzy c-means (Hathaway and Bezdek, 1994).

FuzzyCMedoids([n_clusters, metric, ...])

Fuzzy c-medoids clustering of relational data (Krishnapuram et al., 2001).

FuzzyKModes([n_clusters, m, tol, max_iter, ...])

Fuzzy k-modes clustering of categorical data (Huang and Ng, 1999).

FuzzyKPrototypes([n_clusters, gamma, ...])

Fuzzy k-prototypes clustering of mixed numeric and categorical data (Huang, 1998).

Functions#

relational_distances(R, V[, beta])

Squared relational distances of the training objects to relational prototypes.

matching_dissimilarity(A, B)

Simple matching dissimilarity \(\delta(\mathbf{a},\mathbf{b})=\sum_j[a_j\neq b_j]\) between rows.

pairwise_dissimilarity(X[, Y, metric])

Pairwise dissimilarities of feature vectors by any SciPy metric.

check_dissimilarity_matrix(R[, n_objects, ...])

Validate a (square or rectangular) dissimilarity matrix.

dtw_distance_matrix(X[, Y, window])

Dynamic time warping distances between all pairs of (equal-length) series.

dtw_alignment(x, y[, window])

Optimal warping path between two series (for inspection and plotting).

autocorrelation_features(X[, n_lags])

Sample autocorrelations \(\hat\rho(1),\dots,\hat\rho(L)\) of every series.

autocorrelation_distance_matrix(X[, Y, ...])

Autocorrelation-based distance between time series (D'Urso and Maharaj, 2009).

gower_distance_matrix(X[, Y, ...])

Gower's general coefficient of dissimilarity for mixed data (Gower, 1971).

plot_dissimilarity_matrix(R[, labels, ax, ...])

Heat map of a dissimilarity matrix with the objects ordered by their labels.

plot_dtw_alignment(x, y[, window, ax, ...])

Two series with the dynamic-time-warping correspondences between them.

plot_modes(model[, X, ax, cmap, fontsize])

Table of the fitted modes, shaded by how much membership mass the mode carries.

plot_series_clusters(X, labels[, medoids, ...])

Time series drawn in the color of their cluster, medoid series emphasized.

make_categorical_blobs([n_samples, ...])

Categorical records scattered around planted modes.

make_mixed_blobs([n_samples, n_numeric, ...])

Records with Gaussian numeric attributes and categorical attributes around modes.

make_warped_series([n_series_per_class, ...])

Time series of three shape classes with random time warps.