aidapy.ml.preprocess module

aidapy.ml.preprocess.time_series(X_in, y_in, histsize=1, forecast_offset=0, dropna=True, predict_change=False)[source]

Preprocess time series data for machine learning purposes

Create new features X containing a history of the old features, and define the targets at a future time defined by forecast_offset.

Parameters
  • X_in – input features (2D array)

  • y_in – input targets (1D or 2D array)

  • histsize – how much history to include

  • forecast_offset – index offset of the forecast

  • dropna – remove entries with missing values

  • predict_change – if true, predict change in y (y[t+dt]-y[t])

Returns

X, y, mask

Return type

preprocessed features X and targets y, and the corresponding mask