cluna7

cluna7 / forecastNARX / 0.1.2

README.md

Introduction

The forecastNARX algorithm models the given time series, using a polynomial NARX, and uses the obtained model to make multistep ahead predictions.

The polynomial NARX model is a particular case of the Nonlinear AutoRegresive Moving Average model with eXogenous Inputs.

Algorithm Usage

The algorithm requires:

  1. 'series'. A list of numbers representing the series to be modelled, y(t).
  2. 'target_ERR'. Desired error reduction ratio of the model. Its value must be in the range (0,1)
  3. 'nsteps'. Number of steps that the multistep ahead prediction will be computed for.

Optional parameters used in the model obtention process. Default values shown in parenthesis:

  • 'max_reg(5)': Maximum number of polynomial terms included in the model.
  • 'deg(3)': Polynomial degree of the model.
  • 'in_max_lag(5)': Maximum number of delayed input versions that will be considered.
  • 'out_max_lag(5)': Maximum number of delayed output version that will be used in the model.

The algorithm returns

If a model was obtained successfully:

  1. 'ERR':Achieved "ERR"using the obtained model.
  2. 'forecast': Forecasted values of the given time series using the NARX model.
  3. 'model': The polynomial NARX model used to obtained the 'forecast'.

Example

Input:

{"series":[30,21,29,31,40,48,53,47,37,39,31,29,17,9,20,24,27,35,41,38,
          27,31,27,26,21,13,21,18,33,35,40,36,22,24,21,20,17,14,17,
          26,29,40,31,20,24,18,26,17,9,17,21,28,32,46,33,23,28,22,7,
          18,8,17,21,31,34,44,38,31,30,26,32],
 "target_ERR":0.95,
 "nsteps":10,
 "max_reg":7,
 "deg": 4,
 "in_max_lag": 5,
 "out_max_lag": 5
}

Ouput:

{
  "ERR": 0.9511533041544762,
  "forecast": [
    25.18296634115205,
    29.69501253139319,
    30.75667045850875,
    33.41081527629766,
    35.501609670262766,
    38.94907552923005,
    33.26162296343223,
    26.588038831546218,
    23.935387234445702,
    22.014523181118875
  ],
  "model": "y(k)=0.265414481779y_0(k-1)+25.1829663412-0.101504624368y_0(k-5)+0.000281530706285y_0(k-1)y_0(k-1)y_0(k-5)+0.00447941504716y_0(k-4)y_0(k-4)+0.000317702051927y_0(k-4)y_0(k-5)y_0(k-5)+-0.0262068453505y_0(k-4)y_0(k-5)"
}