fuzzyclust.timeseries.fnn_model_order#
- fuzzyclust.timeseries.fnn_model_order(y, u=None, max_na=4, max_nb=0, n_clusters=6, threshold=None, fnn_tol=5.0, m=2.0, scale=True, delay=1, random_state=None)[source]#
Model order of a NARX model by false nearest neighbors with a cluster-based threshold.
The false-nearest-neighbor test of
false_nearest_neighbors()needs a threshold \(R\) for the ratio \(|y_k-y_j|/\|\mathbf{x}_k-\mathbf{x}_j\|\). By the mean-value theorem the ratio is bounded by the norm of the gradient of the regression function, \(\|\mathrm{d}f(\mathbf{x}_k)\|\), which varies over the operating range of a nonlinear system; a single constant (Rhodes & Morari: \(R=\max_k\|\mathrm{d}f\|\) from a nonlinear model, or heuristics \(10\le R\le 50\)) is therefore either too loose or too strict. Feil, Abonyi & Szeifert [1] estimate the local gradient from a Gath–Geva clustering of the regression data (cluster_based_threshold()) and use the point-wise threshold \(R_k\); the neighbor \(j\) of \(k\) is false when \(|y_k-y_j|/\|\mathbf{x}_k-\mathbf{x}_j\| > R_k\). The percentage \(J(n_a,n_b)\) of false neighbors is tabulated for all orders and the smallest order in the corner where \(J\) drops to (nearly) zero is selected.- Parameters:
- y, uarray_like
ofshape(T,) Output and (optional) input sequences.
- max_na, max_nb
int Largest orders considered.
- n_clusters
int, default=6 Number of Gath–Geva clusters \(c\) per order (the paper used 6).
- threshold
float,optional If given, a constant \(R\) is used instead of the cluster-based \(R_k\) (reference behavior, Table 2 of the paper).
- fnn_tol
float, default=5.0 The selected order is the smallest \(n_a+n_b\) whose percentage of false neighbors is at most
fnn_tolpercent (ties: lower percentage, then smaller \(n_a\)).- m
float, default=2.0 Fuzziness exponent of the clustering.
- scalebool, default=True
Standardize regressors and output first (the threshold and the distances are then dimensionless).
- delay
int, default=1 Lag of the delay embedding for a scalar time series (
u=None);n_ais then the embedding dimension at lagdelay.- random_state
int,RandomStateinstanceorNone
- y, uarray_like
- Returns:
- result
sklearn.utils.Bunch table(DataFrame, rows \(n_a\), columns \(n_b\), in per cent),n_a,n_b(selected orders),thresholds(dict mapping(n_a, n_b)to the array \(R_k\)).
- result
References
[1]B. Feil, J. Abonyi, F. Szeifert, “Determining the model order of nonlinear input-output systems by fuzzy clustering”, in: Advances in Soft Computing – Engineering Design and Manufacturing, Springer, 2003.
[2]C. Rhodes, M. Morari, “Determining the model order of nonlinear input/output systems”, AIChE Journal 44 (1998) 151–163.
[3]J. D. Bomberger, D. E. Seborg, “Determination of model order for NARX models directly from input-output data”, J. Process Control 8 (1998) 459–468.
Examples
>>> from fuzzyclust.timeseries import fnn_model_order, make_nonlinear_io_system >>> u, y = make_nonlinear_io_system(n_samples=600, random_state=0) >>> res = fnn_model_order(y, u, max_na=2, max_nb=2, n_clusters=4, random_state=0) >>> res.table.shape, bool(res.table.loc[1, 2] < res.table.loc[0, 0]) ((3, 3), True)
Examples using fuzzyclust.timeseries.fnn_model_order#
Model-order selection by false nearest neighbors with a cluster-based threshold
State-space reconstruction and prediction of a chaotic time series