@@ -274,9 +274,9 @@ def _mask_missing_value(*arr):
274274 return tuple ([x [mask_nomissing ] for x in arr ])
275275
276276
277- class Narx (RegressorMixin , BaseEstimator ):
277+ class NARX (RegressorMixin , BaseEstimator ):
278278 """The Nonlinear Autoregressive eXogenous (NARX) model class.
279- For example, a (polynomial) Narx model is like
279+ For example, a (polynomial) NARX model is like
280280 y(t) = y(t-1)*u(t-1) + u(t-1)^2 + u(t-2) + 1.5
281281 where y(t) is the system output at time t,
282282 u(t) is the system input at time t,
@@ -333,7 +333,7 @@ class Narx(RegressorMixin, BaseEstimator):
333333 Examples
334334 --------
335335 >>> import numpy as np
336- >>> from fastcan.narx import Narx , print_narx
336+ >>> from fastcan.narx import NARX , print_narx
337337 >>> rng = np.random.default_rng(12345)
338338 >>> n_samples = 1000
339339 >>> max_delay = 3
@@ -351,7 +351,7 @@ class Narx(RegressorMixin, BaseEstimator):
351351 >>> poly_ids = [[0, 2], # 1*u(k-1)
352352 ... [0, 4], # 1*y(k-1)
353353 ... [1, 3]] # u(k-1)*u(k-3)
354- >>> narx = Narx (time_shift_ids=time_shift_ids,
354+ >>> narx = NARX (time_shift_ids=time_shift_ids,
355355 ... poly_ids=poly_ids).fit(X, y, coef_init="one_step_ahead")
356356 >>> print_narx(narx)
357357 | Term | Coef |
@@ -397,16 +397,16 @@ def fit(self, X, y, sample_weight=None, coef_init=None, **params):
397397
398398 sample_weight : array-like of shape (n_samples,), default=None
399399 Individual weights for each sample, which are used for a One-Step-Ahead
400- Narx .
400+ NARX .
401401
402402 coef_init : array-like of shape (n_terms,), default=None
403403 The initial values of coefficients and intercept for optimization.
404- When `coef_init` is None, the model will be a One-Step-Ahead Narx .
404+ When `coef_init` is None, the model will be a One-Step-Ahead NARX .
405405 When `coef_init` is `one_step_ahead`, the model will be a Multi-Step-Ahead
406- Narx whose coefficients and intercept are initialized by the a
407- One-Step-Ahead Narx .
406+ NARX whose coefficients and intercept are initialized by the a
407+ One-Step-Ahead NARX .
408408 When `coef_init` is an array, the model will be a Multi-Step-Ahead
409- Narx whose coefficients and intercept are initialized by the array.
409+ NARX whose coefficients and intercept are initialized by the array.
410410
411411 .. note::
412412 When coef_init is None, missing values (i.e., np.nan) are allowed.
@@ -477,7 +477,7 @@ def fit(self, X, y, sample_weight=None, coef_init=None, **params):
477477 n_terms = self .poly_ids_ .shape [0 ] + 1
478478
479479 if isinstance (coef_init , (type (None ), str )):
480- # fit a one-step-ahead Narx model
480+ # fit a one-step-ahead NARX model
481481 xy_hstack = np .c_ [X , y ]
482482 osa_narx = LinearRegression ()
483483 time_shift_vars = make_time_shift_features (xy_hstack , self .time_shift_ids_ )
@@ -508,7 +508,7 @@ def fit(self, X, y, sample_weight=None, coef_init=None, **params):
508508 )
509509
510510 lsq = least_squares (
511- Narx ._residual ,
511+ NARX ._residual ,
512512 x0 = coef_init ,
513513 args = (
514514 self ._expression ,
@@ -578,7 +578,7 @@ def _residual(
578578 coef = coef_intercept [:- 1 ]
579579 intercept = coef_intercept [- 1 ]
580580
581- y_hat = Narx ._predict (expression , X , y [:max_delay ], coef , intercept , max_delay )
581+ y_hat = NARX ._predict (expression , X , y [:max_delay ], coef , intercept , max_delay )
582582
583583 y_masked , y_hat_masked = _mask_missing_value (y , y_hat )
584584
@@ -622,7 +622,7 @@ def predict(self, X, y_init=None):
622622 f"but got { y_init .shape } ."
623623 )
624624
625- return Narx ._predict (
625+ return NARX ._predict (
626626 self ._expression ,
627627 X ,
628628 y_init ,
@@ -639,7 +639,7 @@ def __sklearn_tags__(self):
639639
640640@validate_params (
641641 {
642- "narx" : [Narx ],
642+ "narx" : [NARX ],
643643 "term_space" : [Interval (Integral , 1 , None , closed = "left" )],
644644 "coef_space" : [Interval (Integral , 1 , None , closed = "left" )],
645645 "float_precision" : [Interval (Integral , 0 , None , closed = "left" )],
@@ -652,12 +652,12 @@ def print_narx(
652652 coef_space = 10 ,
653653 float_precision = 3 ,
654654):
655- """Print a Narx model as a Table which contains Term and Coef.
655+ """Print a NARX model as a Table which contains Term and Coef.
656656
657657 Parameters
658658 ----------
659- narx : Narx model
660- The Narx model to be printed.
659+ narx : NARX model
660+ The NARX model to be printed.
661661
662662 term_space: int, default=20
663663 The space for the column of Term.
@@ -671,14 +671,14 @@ def print_narx(
671671 Returns
672672 -------
673673 table : str
674- The table of terms and coefficients of the Narx model.
674+ The table of terms and coefficients of the NARX model.
675675
676676 Examples
677677 --------
678678 >>> from sklearn.datasets import load_diabetes
679- >>> from fastcan.narx import print_narx, Narx
679+ >>> from fastcan.narx import print_narx, NARX
680680 >>> X, y = load_diabetes(return_X_y=True)
681- >>> print_narx(Narx ().fit(X, y), term_space=10, coef_space=5, float_precision=0)
681+ >>> print_narx(NARX ().fit(X, y), term_space=10, coef_space=5, float_precision=0)
682682 | Term |Coef |
683683 ==================
684684 |Intercept | 152 |
@@ -765,7 +765,7 @@ def make_narx(
765765 refine_max_iter = None ,
766766 ** params ,
767767):
768- """Find `time_shift_ids` and `poly_ids` for a Narx model.
768+ """Find `time_shift_ids` and `poly_ids` for a NARX model.
769769
770770 Parameters
771771 ----------
@@ -810,8 +810,8 @@ def make_narx(
810810
811811 Returns
812812 -------
813- narx : Narx
814- Narx instance.
813+ narx : NARX
814+ NARX instance.
815815
816816 Examples
817817 --------
@@ -912,4 +912,4 @@ def make_narx(
912912 - 1
913913 )
914914
915- return Narx (time_shift_ids = time_shift_ids , poly_ids = poly_ids )
915+ return NARX (time_shift_ids = time_shift_ids , poly_ids = poly_ids )
0 commit comments