BLOG

Time Series Forecasting

Calendar Icon
December 19, 2024
6-minute read
Illustration of digital workforce scheduling: A man uses drag-and-drop to add a scheduling element to a digital shift schedule, surrounded by data dashboards and charts.

Table of Contents

Working closely with one of our clients, we have developed an innovative tool for optimizing workforce allocation. A challenge that many companies face time and again is the efficient planning and allocation of employees to avoid both overstaffing and understaffing. This is particularly crucial in industries with highly fluctuating order volumes, as it helps reduce costs and increase customer satisfaction.

A tool like this offers many advantages. It not only helps companies better plan their employees’ work schedules, but also boosts productivity and increases employee satisfaction. By forecasting staffing needs based on historical data, companies can take proactive measures and allocate resources effectively.

Requirements Gathering

To develop an application for the optimal allocation of staff, we began with a comprehensive requirements analysis. This revealed that transparency and the ability to understand how decisions are made are of the utmost importance to the employees involved. Especially with AI applications, it is often not clear down to the smallest detail how certain results are arrived at, which can lead to mistrust and resistance.

Our goal was therefore to develop a solution that not only operates precisely and efficiently, but is also easy to control and understand. The ability to influence the underlying parameters is thus particularly important for ensuring sufficient transparency and acceptance.

Decision-Making and Requirements for the Tool

As we conducted our analysis, it quickly became clear that this task was ideally suited for a solver. Since we work in a Java environment, we began our search for suitable tools and came across OptaPlanner. OptaPlanner is a rule-based engine built on Drools that allows you to define various criteria and rules and then find the best solutions.

However, our analysis also showed that it would not be prudent to leave the entire problem to this engine. This would significantly limit the transparency of decisions and the ability to exercise control. We then defined the core functions that the tool must fulfill:

  • Calculating and forecasting workload: The tool must be able to accurately predict future workload requirements.
  • Determining Staffing Needs: The necessary staffing requirements should be calculated based on the forecasts.
  • Optimal Staff Assignment: Employees should be assigned to specific tasks based on their qualifications and availability.

OptaPlanner meets the need to deploy employees exactly where they are needed most.

Time Series Forecasting

One of the key challenges was to accurately forecast future workloads. We also had access to an extensive set of KPIs, such as: new orders, completed orders, open orders, and processing times.

To make effective use of this data, we have opted for the time series forecasting method. This proven data forecasting technique is widely used, particularly in time-sensitive industries such as transportation, logistics, and energy. It allows us to analyze historical data, identify patterns and trends, and derive reliable forecasts from them.

Frameworks

Since our project is based in the Java environment, we initially looked only at Java-based frameworks. In doing so, we found that there are very few specialized frameworks for time series forecasting in Java. This limitation presented us with the challenge of finding more suitable solutions.

Python and Pandas

At first, Python—with its extensive Pandas library—seemed like an attractive alternative. Pandas offers numerous options for manipulating and analyzing time-series data. However, using these tools requires a significant amount of programming and data management effort. That would significantly slow down the development process for our application and increase its complexity.

Nixtla and NeuralForecast

During our research, we came across Nixtla, specifically the NeuralForecast library. Nixtla offers a collection of tools for time-series forecasting that were specifically designed for easy integration and high accuracy.

Advantages:

  • Easy Integration: Nixtla integrates easily into existing projects and requires no extensive preparatory work.
  • High Accuracy: By utilizing advanced neural networks, NeuralForecast delivers highly accurate forecasts.
  • Efficient Cross-Validation: Nixtla offers built-in cross-validation features that allow you to verify and improve the accuracy of your models.

Cross-validation is a technique used in machine learning to evaluate a model’s performance. In this process, the available dataset is divided into several parts, known as folds. The model is then trained and tested multiple times, with a different portion of the data used as the test set and the remaining data used as the training set in each iteration.

Selection and Application of Specific Algorithms

In our time series forecasting project, we decided to compare the following algorithms:

  • TimesNet
  • NHiTS
  • NBEATS

TimesNet
TimesNet is a neural network designed specifically for time series forecasting. It uses deep learning to identify complex patterns and relationships in the data. A key advantage of TimesNet is its ability to make both short-term and long-term forecasts with high accuracy.

NHiTS (Neural Hierarchical Interpolation for Time Series)
NHiTS uses a multi-stage interpolation strategy to improve forecasts. This method is particularly useful for time series with seasonal patterns and makes it possible to capture both fine details and long-term trends simultaneously.

NBEATS (Neural Basis Expansion Analysis for Time Series)
NBEATS uses a basis expansion technique to generate predictions. It is known for its high prediction accuracy and its ability to perform both additive and multiplicative decompositions.

Example:

(Source: Python)

The graph shows historical data on new orders received in blue. It is clear that very few orders are received on weekends, which is reflected in the dips in the blue curve.

The forecasts from the various models are shown in green, orange, and red. The NHITS and NBEATSx models are very similar and closely follow the pattern of the historical data. The RNN model shows greater variation in its forecasts and predicts fewer orders on weekends, which is more in line with the actual trend. With targeted adjustments, this model can provide even more accurate forecasts and better account for fluctuations in order volume.

In summary, all three models are performing satisfactorily, even though none of them is perfect yet and they are not yet in production use. The analysis has shown that further optimizations are necessary—such as the manual or API-based addition of holidays, as well as accounting for specific peak loads at the customer’s site. Despite these outstanding issues, the initial results are already very promising.

Conclusion

The challenges and opportunities that arise in such a project demonstrate just how crucial it is to align technological innovation with specific business needs. By using time series forecasting and evaluating various algorithms, companies can accurately predict future workloads and plan their resources efficiently. Although the initial results are promising, there is still room for improvement.

Overall, it is clear that such solutions not only increase efficiency and reduce costs, but can also sustainably improve employee and customer satisfaction. Companies facing similar challenges can benefit from this approach and should consider implementing such technologies into their planning processes.

Sources

https://www.nixtla.io

share ->

Related Articles

Home
Company