Demand Forecasting: Fluctuating Features

April 21, 2022

by Farshad Kheiri, PhD and Casey Cole

Legion Wfm Demand Forecasting Fluctuating Features

Farshad is the Head of Legion’s AI and Data Science. He has extensive experience in different areas of machine learning. Farshad has built and led Data Science teams for several successful startups. He holds a Ph.D. in Electrical Engineering with a minor in Mathematics and two Master’s degrees.

Casey Cole is a Senior Data Scientist at Legion. She has diverse experience in many subdomains of machine learning and data science, as demonstrated in her 20+ peer-reviewed articles and 1 US patent focusing on pattern recognition techniques. She holds a Ph.D. in Computer Science and an MS in Computer Science with minors in Bioinformatics and Sociology.

Legion Demand Forecasting applies machine learning to capture the patterns in your historical demand data. In addition to the raw, time-series data, Demand Forecasting uses custom data sources, identified and cultivated by our data science team over several years, that are predictive.

Legion Machine Learning Captures Data Patterns

Every three months, our AI platform selects the best model from more than 50 models. As new data comes in, the models are retrained weekly to take advantage of the most recent data.

Through this machine-learning approach, Legion captures data patterns. However, some features fluctuate more rapidly and are therefore not always captured when retraining every week. The prime example of this phenomena is weather. While it is true that weather data is available as much as ten days in advance, studies have shown that data more than three days in the future is, at most, 80% accurate. A naive approach to ensure that the models do not miss this important information might be to change the cadence of retraining the models from one week to every day. However, even though the impact of these fluctuating features is clear retrospectively, these features (events) are often so rare that we may not have the same event in the historical data. And therefore, traditional machine-learning models will not be able to learn to catch this anomalous impact even if retrained on a daily basis.

To overcome this limitation of traditional machine-learning approaches, Legion applies its proprietary active-learning technique, updating the demand prediction as new data comes in. Instead of waiting for the weekly retrain, the model is updated when the new data appears in the system.

Legion Demand Forecasting Test Results

We back tested this model using several customers’ historical data and got the following results.

Before our algorithm was applied, the accuracy of a client-provided base model for a particular day was 28.14%. After applying our proprietary algorithm, the accuracy increased to 78.05% (the raw demand forecast changed by 63.95%).

For a store in a given year, our algorithm changed just 6.3% of the generated forecasts, and on average, the forecast accuracy for those days changed from 53.3% to 63.7% (10% improvement). In addition, the raw value of the demand forecasts for those days changed by 27.92%, which could significantly impact the labor forecast.

At the enterprise level (all stores for a given business), our algorithm changed 7.1% of the forecasts annually, causing a 10.9% average increase in the forecast accuracy for those days. The forecasted demand changed 25.4% on average for the impacted days.

Table 1 summarizes the single day, location, and enterprise-level results described above.

Table 1: Single Day, Location, and Enterprise-Level Results

Cases Average yearly change in the forecasts (%) Daily accuracy before algorithm Daily accuracy after algorithm Forecast Change (%)
Day Level 28.14 78.05 63.95
Location Level 11 (6.3%) 53.3 63.7 27.92
Enterprise Level 10 (7.1%) 48.3 59.2 25.4

Legion’s proprietary algorithm uses daily weather forecast data to improve the ML-based generated forecast in the near future. These improvements can result in a reduction or increase in the number of demand forecasts.

Take the weather from Figure 1 as an example. For this client, the forecasted demand based on past data for July 9th, 2021 was 11,287. The actual demand for that day ended up being only 3,176. As seen for this day in Figure 1, the rainy weather conditions could explain this discrepancy on that day. By applying our algorithm, the predicted demand automatically adjusted to 4,069, resulting in a substantially better labor estimate for that day.


Figure 1 (source: timeanddate.com)

Sometimes, the historical data are impacted by bad weather, resulting in lower forecasts. However, it is also true that a change in weather conditions could increase demand. Legion’s algorithm can pick up those cases as well. For another customer, the original forecasted demand on October 17th was 12,093. The actual demand was 15,104. Our algorithm was able to adjust this predicted value to 15,422. The reason for this increase was a combination of the unusually cool weather and the reprieve from the rainy conditions of the day before (as shown in Figure 2).


Figure 2 (source: timeanddate.com)

Learn More

To see how your business can use Legion Demand Forecasting, please request a demo.