Search code examples
machine-learningtime-seriesdata-sciencedata-analysisforecasting

Model for Time Series Analysis


I was just curious to know if we have a model that takes into account, both of the factors for time series prediction (e.g. predicting future Sales).

The problem is that if we are using something like ARIMA, then it doesn't consider the important information (like the new promotions added by Company or may be the other factors like product type etc).

And on the other hand, if I am using the machine learning models like Random Forests, then I loose the information of trends and seasonality.

Do we have something that combines both of these?


Solution

  • ARIMA models can take additional information besides the time series data itself. These are called causal variables or exogenous variables. See ARMAX and ARIMAX models.

    It is a little bit more complicated with Exponential Smoothing type models (Holt, Holt-Winters, etc...).

    Machine learning models can be used for for times series data too, you just need to format the data in the right way.

    For a traditional time series model, the data looks like this:

    Train              Test 
    [1, 2, 3],          [4]
    [1, 2, 3, 4],       [5]
    [1, 2, 3, 4, 5],    [6]
    [1, 2, 3, 4, 5, 6], [7]
    

    You can reformat the data so that it looks like a supervised learning problem:

    Train:    [1, 2, 3 | 4]
              [2, 3, 4 | 5]
              [3, 4, 5 | 6]
    -----------------------
    Test:     [4, 5, 6 | 7]
    

    The you can apply most of the supervised ML methods. Note however, that for ML models the time series input will always be a fixed number of lags (compared to sequential models like exponential smoothing.)