title: How to run a non-linear autoregression with exogenous inputs with sysidentpy?
body: <p>I am trying to run a nonlinear autoregression with exogenous inputs (NARX) in Python.</p>
  <p>This is my code</p>
  <p>Step 1: import the libraries</p>
  <pre><code>import numpy as np
  import pandas as pd
  import matplotlib.pyplot as plt
  from sysidentpy.model_structure_selection import FROLS
  from sysidentpy.basis_function import Polynomial, Fourier
  from sysidentpy.metrics import root_relative_squared_error
  from sysidentpy.utils.generate_data import get_siso_data
  from sysidentpy.utils.display_results import results
  from sysidentpy.utils.plotting import plot_residues_correlation, plot_results
  from sysidentpy.residues.residues_correlation import compute_residues_autocorrelation, compute_cross_correlation
  from sklearn.model_selection import train_test_split
  </code></pre>
  <p>Step 2: import the data</p>
  <pre><code>df=pd.read_excel(r&quot;C:\Users\Action\Downloads\Python\Practice_Data\sorted_data v2.xlsx&quot;)
  </code></pre>
  <p>Step 3: Organize the data</p>
  <pre><code>target_column = ['public health care services'] 
  predictors = list(set(list(df.columns))-set(target_column))
  df[predictors] = df[predictors]/df[predictors].max()
  </code></pre>
  <p>Step 4: Step up the training and testing data</p>
  <pre><code>X = df[predictors].values
  y = df[target_column].values
  X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30, random_state=40)
  print(X_train.shape); print(X_test.shape)
  </code></pre>
  <p>Step 5: Create the NARX Neural Network Model</p>
  <pre><code>basis_function = Polynomial(degree=2)
  model = FROLS(
      basis_function=basis_function,
      order_selection=True,
      n_info_values=10,
      extended_least_squares=False,
      ylag=2, xlag=2,
      info_criteria='aic',
      estimator='least_squares',
  )
  </code></pre>
  <p>Step 6: Apply fit the model</p>
  <pre><code> model.fit(X_train, y_train)
  </code></pre>
  <p>From step 6 I am experiencing an error</p>
  <p>TypeError: fit() takes 1 positional argument but 3 were given</p>
  <p>Step 7: Prediction</p>
  <pre><code>yhat = model.predict(X_test, y_test)
  </code></pre>
  <p>I am also experiencing an error</p>
  <p>AttributeError: 'FROLS' object has no attribute 'final_model'</p>
  <p>Step 8: Compute the RRSE</p>
  <pre><code>rrse = root_relative_squared_error(y_test, yhat)
  print(rrse)
  </code></pre>
  <p>I am experiencing the following error</p>
  <p>NameError: name 'yhat' is not defined</p>
  <p>Well, I realise that this error is due to the error before it, so 'yhat' is not defined.</p>
  <p>I would be grateful for any assistance.</p>