TIM strives to follow all best practices in time-series modeling to achieve the best possible accuracy as fast as possible. The architectural design of the model building phase of the TIM engine is illustrated in the image below.
Some of the specifics of this architectural design are discussed in the following subsections. More information about how the model building phase fits into the overall TIM (RT)InstantML Forecasting solution can be found in the Overview section.
The multi-situational layer¶
When building a model, TIM tries to recognize all situations that might require a specific model. A situation in this context is a combination of the time of forecasting, the forecasting horizon and the data availability. Usually, many different situations occur. TIM creates a separate model for each situation, optimized given the situation's conditions, and then combines all of these models into one Model Zoo. When TIM is asked to make a forecast, the current situation is automatically recognized, the appropriateness of each model is assessed, new models are built if necessary and finally, the forecast is produced.
TIM is designed to go through all the predictors included in the dataset and understand which of these predictors are important and which do not contribute to the final results. In the process of expansion, TIM creates many new features from the original predictors to enhance the final model's performance. This is done through a set of common transformations called features. If some of the features turn out to not contribute to a better model performance, TIM can recognize this without compromising on accuracy. This enables the creation of very simple models for straightforward situations - such as solar production at night, for example - and more complex models for more difficult situations. In other words, TIM is able to include necessary complexity in certain situations, while eliminating redundant complexity in other situations. As a lot of focus is put on TIM's fast forecasting capabilities, it is important that TIM can recognize how these situations differ from each other. TIM can intelligently exploit similarities between models during model building.
This optimization of all individual models is run by TIM's multi-situational layer.
There are three qualities that distinguish different situations from each other:
- The distance of the timestamp of the desired forecast from the last available target data point. This relates back to the position of the timestamp in the desired forecasting horizon. In general - TIM creates a separate model for each point in the forecasting horizon. This is due to the fact that it is, in general, more difficult to forecast further into the future and therefore models that are built to forecast over a different distance should be able to vary in their complexity.
- The specific time of day of the timestamp of the desired forecast. Some datasets exhibit a property called daily cycle. This means that there is a visible periodicity influenced by socio-economic or other factors repeating day after day; in other words, a daily seasonality. It is oftentimes more difficult to forecast something happening at noon than during the night, for example. In such cases, TIM distinguishes different times of the day and creates a separate model for each time. The detection of the daily cycle is done automatically, but can also be set manually.
- The distance of the timestamp of the desired forecast from the last available data points of every predictor. One of the most important features that can be extracted from the data when dealing with time series is offsets (lags) of the predictors. The available offsets often differ from time to time however, because of irregularities in the data gathering processes. TIM tries to exploit the predictive power of the most recent available data records and therefore distinguishes between a situation where, for example, a -24 offset of a predictor is available and a situation where -22 offset of the predictor is available. It's often worth building a new model if you can use a closer offset of a predictor than the one a previously built model used. Vice versa, it is necessary to build a new model if an offset of a predictor that a previously built model relied on is no longer available.
Situations vs models¶
After TIM is given a forecasting task, it first recognizes all situations (as described above) that it needs to address. Then, it looks at all situations covered by the models in the attached Model Zoo. The situations which lack models are then sent to the model building process and new models are generated to cover them. Finally, the old Model Zoo is merged with the new models and returned for further use. This enables users to greatly shorten the forecasting time required in production by interpreting already built models instead of building the entire Model Zoo from scratch. The whole rebuilding process can also be configured to better suit the needs of any particular application.
TIM is designed to go through all the predictors a user includes in the dataset and understand which of these predictors are important and which do not contribute to the final results. In the process of expansion, TIM creates many new features from the original predictors to enhance the final model's performance. This is done through a set of common transformations called features. If some of the features turn out to not contribute to the model's performance, TIM can recognize this without compromising on accuracy.
The previously discussed process of expansion creates many new features. It is not optimal to retain all of these new features in the final model, as many of them will be highly correlated. Having highly correlated features in a model makes it highly unstable: a small change in a feature could result in a structural change of the whole model, because the model's results are influenced by many similar features (correlated with the one that initially changed). This is not desirable. Therefore, only the most important subset of features will be retained for the final model, eliminating the high correlation among various features.
Increasing model stability by eliminating inner correlation is similar to fighting a phenomenon called overfitting.
Choosing a smaller subset of variables/features - i.e. the process of reduction - is a widely researched topic; algorithms like LASSO, PCA and forward regression are all well known to the public. TIM uses a similar technique that heavily relies on a geometrical perspective and incorporates a tweaked Bayesian Information Criterion.