fuzzyclust.timeseries.select_structure_mixed#

fuzzyclust.timeseries.select_structure_mixed(X, y, discrete=None, n_clusters=3, max_inputs=None, m=2.0, vct_tolerance=0.2, feature_names=None, random_state=None)[source]#

Rank all candidate input structures by their fuzzy variance (Girimonte, Babuška & Abonyi).

Every continuous input is partitioned into fuzzy sets by fuzzy c-means (the number of sets fixed or chosen by the Xie–Beni index), every discrete input into crisp sets, one per value. For every subset of at most max_inputs inputs the total fuzzy variance \(\sigma_t\) (fuzzy_variance()) of the output over the product-space segments is computed; structures are ranked by increasing \(\sigma_t\) and the variance–complexity trade-off \(VCT=\sigma_t\,n_i\) is reported to distinguish structures of similar \(\sigma_t\) with different numbers of inputs \(n_i\) (an irrelevant input lowers \(\sigma_t\) a little, because it splits the data into more segments, but it raises the VCT). No model has to be fitted, and discrete and continuous inputs are handled alike. The final choice is left to the user, who typically compares a few top-ranked structures by fitting models; the column vct and MixedInputStructureSelection.best_structure_ only point at the first clear dip of the VCT curve.

Parameters:
Xarray_like of shape (n_samples, n_inputs)
yarray_like of shape (n_samples,)
discretearray_like of bool or of int, optional

Mask or indices of the discrete (categorical) inputs.

n_clustersint, “xie-beni” or sequence, default=3

Number of fuzzy sets per continuous input; a sequence gives one value per input (entries of discrete inputs are ignored).

max_inputsint, optional

Largest cardinality of the structures searched (the search is exhaustive, \(\sum_{k\le\max}\binom{n}{k}\) structures). Default: min(n_inputs, 6).

mfloat, default=2.0
vct_tolerancefloat, default=0.2

Structures whose \(\sigma_t\) is within this relative tolerance of the smallest one are considered of similar variance; among them the one with the smallest VCT is the recommended structure.

feature_namessequence of str, optional
random_stateint, RandomState instance or None
Returns:
rankingpandas.DataFrame

One row per structure sorted by sigma_t, with columns inputs (tuple of names), n_inputs, sigma_t, vct; the index is the rank (1 = best).

References

[1]

D. Girimonte, R. Babuška, J. Abonyi, “Fuzzy clustering for selecting structure of nonlinear models with mixed discrete and continuous inputs”, Proc. IEEE Int. Conf. Fuzzy Systems, 2004.

Examples

>>> from fuzzyclust.timeseries import select_structure_mixed, make_mixed_input_system
>>> X, y, disc = make_mixed_input_system(n_samples=600, random_state=0)
>>> ranking = select_structure_mixed(X, y, discrete=disc, n_clusters=3, random_state=0)
>>> set(ranking.iloc[0]["inputs"]) >= {"x1", "x2", "x3", "x4"}
True

Examples using fuzzyclust.timeseries.select_structure_mixed#

Model-free structure selection with mixed discrete and continuous inputs

Model-free structure selection with mixed discrete and continuous inputs