General Information

Time-series forecasting is one of the important machine learning applications strongly connected with various business domains - from Retail and Finance to Manufacturing and Predictive Maintenance. There are many cases when the predictive problem requires time components involvement, especially when the prediction is related to the processes that change over time. These dependencies can be identified and analytically described.

In time series forecasting, we are using the model to predict the future values of the target numerical variable based on its historical data - previously observed values. It is essential to differentiate the regression analysis and time series forecasting. While the regression is aimed to describe the relationships between two or more numerical variables (time series), the time series forecasting reconstructs the relationships between different points in time within the same series. There are some typical examples:

Data Processing pipeline

Time Series Forecasting brick provides the possibility to train and apply the forecasting model based on the analysis of historical time-series data with the inline capabilities of its preprocessing. Brick processing pipeline consists of three parts:

  1. Time Series feature extraction

    1. Trend and Seasonality

      Time series data is represented by using the additive model:

      $y(t)=T(t)+S(t)+N(t)$

      where

      $T(t)$ - a non-linear trend that reflects long-term increasing or decreasing data.

      $S(t)$- seasonality, some patterns, occurring when a time series is affected by seasonal factors connected with yearly, weekly, or daily activity so that the time-series can be characterized by corresponded seasonality.

      $N(t)$-noise, which describes random, irregular influences that can't be explained by trend and seasonality effects.

      Seasonal effects are defined automatically, but the manual settings are also supported.

    2. Data logging time parameters

      Data gathering usually has some logging frequency, and we may extract this information to understand the optimal discretization step and the missing time-steps diagnostic.

    3. Additional regressors

      Regressors are the extra features that provide additional information about factors that impact the forecasted variable and are known in the past and the future. As there is a possibility to use any numerical columns as regressors, the brick assesses their predictive abilities regarding the target variable and chooses the variables that meet the predictability requirements.

    4. Negative target values support

      In many business applications, we do not operate with the negative values of the forecasted variable, like in the case of demand level, customer interest rate, currency exchange rate. It is a minimal list of the situations when the target variable can not take the negative values, so we may preliminary analyze the data and identify if there is a necessity to apply the non-negative prediction restrictions.

    5. Forecasting horizon detection

      The optimal forecasting horizon depends on the time-series structure - the length of the historical data, seasonality, cycling components, and forecasting model's parameters - all of these factors are considered to apply the trained model to make the forecast.

  2. Preprocessing time-series before modeling

    1. Outliers Treatment

      If the time series has the point-type outliers they can be detected by using the median average approach:

      $\hat{y}t=median(y{t-k}, y_{t-k+1},...y_{t-1},y_t,y_{t+1}, ..., y_{t+k-1}, y_{t+k})$

      $Y_{anomalies} = \{y_t, |y_t-\hat{y}_t|>(3\times\ \sigma(Y))\}$

      The abnormal cases are changed to the estimated median value.

    2. The Discretisation of Time Series data that supports several aggregation methods

      The processed time series can be converted to specific time-step observations like hours or days and depicts the general behavior for the observed period. For instance - the average daily temperature, or the total sum of the sales product items per week. Time Series forecasting brick supports the following aggregation configuration:

      • Time Steps - minutes, fourth, days, month, year
      • Method - min, max, mean, median, sum, first, last
    3. Filling the missing dates

      Time series might have some gaps in the data logging that may be explained by the different reasons - from technical issues to the activity absence. In some cases, these gaps might be ignored, and the time series is passed to the model training as is, but there are cases when we are interested in leading the time series to the normalized view.

    4. Treatment of the missing values in the target variable

      If the target variable has missing values, we should handle them via one of the proposed strategies: forward/ backward fill, linear interpolation, mean, and zero filaments. The first three strategies suppose the sequential processing of the time series, while "mean" and "median" allows to change all the missing values by one of the position statistics.

  3. Forecasting model fitting and applying

    As a core of Time Series forecasting, we use the FB Prophet model (see Prophet brick). Model is trained on the prepared data and applied to the future with the saving the data structure.

The one more available functional configuration is Stratification. Stratification allows to set up of the column for the dataset stratification. This setting is optional and should be used in the case when the data contain several time-series, which describe the independent processes:

<aside> ℹ️ Example: The pharmacy chain management would like to improve their planning processes via demand forecasting in the different outlets. It means that we should gather the data that reflect the sales history for each pharmacy branch and analyze them independently.

</aside>

Brick Usage

Time Series Forecasting supports two modes of usage:

Description

Brick Location