fuzzyclust.large.extend_partition#
- fuzzyclust.large.extend_partition(X, V, m=2.0, chunk_size=None)[source]#
Memberships of (many) samples in fixed prototypes (the extension step).
One FCM membership step with the prototypes held fixed,
\[\mu_{ik}=\frac{1}{\sum_{j=1}^{c}\big(D_{ik}/D_{jk}\big)^{2/(m-1)}},\qquad D^2_{ik}=\norm{\mathbf{x}_k-\mathbf{v}_i}^2 ,\]evaluated chunk by chunk so that the working memory stays \(O(\text{chunk size}\cdot c)\). This is how rseFCM, spFCM and oFCM assign the whole data set to the clusters they found on samples or chunks.
- Parameters:
- Xarray_like
ofshape(n_samples,n_features) - Varray_like
ofshape(n_clusters,n_features) - m
float, default=2.0 - chunk_size
intorNone, default=None Samples per chunk;
Noneprocesses all samples at once.
- Xarray_like
- Returns:
Examples
>>> import numpy as np >>> from fuzzyclust.large import extend_partition >>> X = np.array([[0.0], [1.0], [9.0], [10.0]]) >>> U, d2 = extend_partition(X, np.array([[0.5], [9.5]])) >>> U.argmax(axis=1) array([0, 0, 1, 1])