AutoRegressive model with eXogenous input (ARX)

class softsensor.arx.ARX(order: Tuple[int, int])[source]

Represents an AutoRegressive with eXogenous input model.

Parameters:

order (Tuple[int, int]) – Parameter for the order of the outputs and inputs in den equation (na, nb)#

Return type:

None.

Example

>>> import pandas as pd
>>> import numpy as np
>>> import softsensor.arx as arx
>>> d = {'in_col': np.linspace(0, 100, 101),
         'out_col': np.linspace(100, 0, 101)}
>>> df = pd.DataFrame(d)
>>> arx = arx.ARX(order=(2, 2))
>>> arx.fit(data_train=[df], input_sensors=['in_col'], output_sensors=['out_col'])
>>> print(len(arx.parameters))
4
build_data_matrix(data_train: List[DataFrame], data_type: str) ndarray[source]

Build the output matrix or input matrix with all data points from list of DataFrames.

Parameters:
  • data_train (list[pd.DataFrame]) – Training data

  • data_type (str) – Selector to create the outputs or inputs

Returns:

output – Output matrix

Return type:

tuple[np.ndarray, np.ndarray]

fit(data_train: List[DataFrame], input_sensors: List[str], output_sensors: List[str], windows: List[Tuple[int, int]] = None, verbose: bool = False) None[source]

Fit the ARX model

Parameters:
  • data_train (list[pd.DataFrame]) – Training data

  • input_sensors (list[str]) – Name of the input sensors.

  • output_sensors (list[str]) – Name of the output sensors.

  • windows (Optional[list[tuple[int, int]]]) – Set the windows for fitting the ARX parameters.

  • verbose (bool) – Verbose flag for additional information.

Return type:

None

prediction(data_test: DataFrame) DataFrame[source]

Predict the outputs to the input data

Parameters:

data_test (pd.DataFrame) – Input to the system

Returns:

output – Predicted output of the system

Return type:

pd.DataFrame

static print_parameters(model_name: str, sensor_name: str, parameters: ndarray)[source]

Prints the parameters formatted according to the sensor name.

Parameters:
  • model_name (str) – The model name as string.

  • sensor_name (str) – The sensor name as string.

  • parameters (np.ndarray) – The parameters according to the sensor name.