• /
  • /
ML‑Powered Demand Forecasting: Methods, Data, and Limitations
Machine learning algorithms have long been used in tasks where the target metric is influenced by many factors. Boosting models based on decision trees, recurrent neural networks, and other methods make it possible to capture complex relationships between features and adapt to a wide range of business scenarios. These same algorithms can also be applied to time series forecasting, but with certain specifics.
What a Time Series Is and Why It Requires a Separate Approach
A time series is data ordered in time. Weather history, currency exchange rates, daily product sales — all of these are examples of time series. Their key characteristic is that the order of observations matters. It is the ordered sequence that allows us to see seasonality, cycles, trends, and other patterns that cannot be detected in shuffled data.

There are two major classes of methods for working with such data:
  • classical autoregressive models that use only past values of the series;
  • machine learning models that can be adapted for time series by adding the necessary features and structure.
How a Classical Regression Task Works in ML
To understand the difference, consider a task unrelated to time. Suppose we need to predict a person’s height based on features such as gender, age, country of residence, and weight. Each feature helps the model refine its prediction. The algorithm searches for relationships between the input parameters and the target variable, and the order of rows in the table does not affect the result.

In classical regression tasks, unlike time series forecasting:
  • observations are independent,
  • there are no cycles,
  • no seasonality,
  • no temporal structure.
Therefore, classical ML algorithms work with them “out of the box.”
What Changes in Time Series Forecasting
In forecasting sales or demand, the situation is different. The order of observations becomes critically important because the model must account for dynamics.

To enable an ML model to work with such data, they must be prepared:
  • sorted by time,
  • enriched with lags (values from previous days),
  • transformed into rolling windows (e.g., weekly, bi‑weekly, monthly averages),
  • supplemented with calendar features (day of week, month, holidays),
  • and, if necessary, external factors (weather, marketing, competitor prices).
All the features listed above must be prepared so that they have the same time‑series structure as the target variable. For each day, we must have records of all features (factors) that help better predict the unknown value.

A concrete example: the target variable is sales; the factors are weather, day of week, holidays, promotions.
How to Train the Model
Suppose we have collected a table with the sales we want to forecast and the factors that, according to expert opinion, should influence them. For each day, we have values for sales and all relevant factors. Then our algorithm can be represented by a simple formula:

y = f(X)

Where y is the forecast, f is the algorithm, and X is the data at time t. The essence of training the model f is to ensure that, based on the provided data, the algorithm produces the smallest possible error.

To build a forecasting algorithm, you need to:
  • prepare all necessary data,
  • choose an algorithm or a set of algorithms for forecasting,
  • split the data into training and test sets,
  • train and tune the model,
  • evaluate model quality metrics on the test set,
  • compare the model’s metrics with those of simple classical models.
Why Understanding the Methodology Matters
Understanding how models are trained allows you to correctly assess their applicability. Some limitations are not related to the algorithms themselves but to the nature of the data: the length of the historical record, the regularity of sales, the quality of features, and the presence of external factors.

We discussed some of these limitations in our previous article Forecasting in the Age of Market Shocks

Machine learning performs well where the metric is influenced by many factors, where scalability is important, and where the data is rich enough for the model to detect patterns. But ML approaches require discipline: careful feature engineering, regular model updates, and transparent infrastructure around them.