fuzzyclust.models.ruspini_partition#
- fuzzyclust.models.ruspini_partition(X, n_sets=3)[source]#
Ruspini-type (equidistant triangular) partition of every feature, the unsupervised baseline.
The \(n_\text{sets}\) triangular sets have their peaks equally spaced between the minimum and the maximum of the feature and their feet at the neighboring peaks, so the memberships sum to one everywhere (a Ruspini partition). Nothing about the class labels or the distribution of the data enters, which is why Abonyi (2010) compares the supervised partition against it. The sets are returned in the same
dictstructure assupervised_fuzzy_partition()(sigmasequal one third of the spacing, so that the triangle ofmembership_1d()has its feet at the neighboring centers).- Parameters:
- Xarray_like
ofshape(n_samples,n_features) - n_sets
int, default=3
- Xarray_like
- Returns:
Examples
>>> import numpy as np >>> from fuzzyclust.models import ruspini_partition, membership_1d >>> parts = ruspini_partition(np.linspace(0, 1, 11)[:, None], n_sets=3) >>> parts[0]["centers"] array([0. , 0.5, 1. ]) >>> A = membership_1d([0.25], parts[0]["centers"], parts[0]["sigmas"], "triangle") >>> A.round(3) array([[0.5, 0.5, 0. ]])