Time series in demand forecasting, CC load, product recommendations and anomaly search

The article discusses the scope of time series, the tasks to be solved, and the algorithms used. Time series forecasting is used in such tasks as demand forecasting, contact center load forecasting, road and Internet traffic, solving the cold start problem in recommender systems, and searching for anomalies in the behavior of equipment and users.

Let's consider the tasks in more detail.

Time series in demand forecasting, CC load, product recommendations and anomaly search

1) Demand forecasting.

Purpose: to reduce warehouse costs and optimize the work schedule of staff.

How is it solved: having a forecast of purchases of goods and the number of customers, we minimize the amount of goods in the warehouse, and store exactly as much as they buy in a given time range. Knowing the number of clients at any given time, we will draw up an optimal work schedule so that there is a sufficient number of staff with a minimum of costs.

2) Predicting the load on the delivery service

Purpose: to prevent the collapse of logistics during peak loads.

How it is solved: predicting the number of orders, bring the optimal number of cars and couriers to the line.

3) Predicting the load on the contact center

Purpose: to ensure the required availability of the contact center with a minimum of costs for the payroll fund.

How it is solved: forecasting the number of calls in time, we will make an optimal schedule for operators.

4) Traffic prediction

Purpose: to predict the number of servers and bandwidth for stable operation. So that your service does not fall on the day of the premiere of a popular series or a football match 😉

5) Forecasting the optimal time of collection of ATMs

Goal: Minimize the amount of cash stored on the ATM network

6) Solutions to the cold start problem in recommender systems

Purpose: to recommend relevant products to new users.

When a user has made several purchases, a collaborative filtering algorithm can be built for the recommendation, but when there is no information about the user, it is optimal to recommend the most popular products.

Solution: The popularity of products depends on the time when the recommendation is made. Using time series forecasting helps to identify relevant products at any particular point in time.

Life hacks for building recommender systems are discussed in previous article.

7) Search for anomalies

Purpose: to identify problems in the operation of equipment and non-standard situations in business
Solution: If the measured value is out of the confidence interval of the forecast, an anomaly has been identified. If this is a nuclear power plant, it's time to increase the square of the distance 😉

Algorithms for solving the problem

1) Moving average

The simplest algorithm is the moving average. Let's calculate the average of the last few elements and make a prediction. For weather forecasts longer than 10 days, a similar approach is used.

Time series in demand forecasting, CC load, product recommendations and anomaly search

When it is important that the last values ​​in the series contribute more weight, we introduce coefficients depending on the distance of the date, obtaining a weighted model:

Time series in demand forecasting, CC load, product recommendations and anomaly search

So, you can set the W coefficient so that the maximum weight falls on the last 2 days and the input days.

Accounting for cyclical factors

The quality of recommendations can be affected by cyclical factors such as coincidence with the day of the week, date, precedence of holidays, etc.

Time series in demand forecasting, CC load, product recommendations and anomaly search
Rice. 1. Example of time series decomposition into trend, seasonal component and noise

Exponential smoothing is a solution to take into account cyclical factors.

Consider 3 basic approaches

1. Simple smoothing (Brown model)

Represents the calculation of the weighted average on the last 2 elements of the series.

2. Double smoothing (Holt model)

Takes into account the change in trend and fluctuations in residual values ​​around this trend.

Time series in demand forecasting, CC load, product recommendations and anomaly search

We calculate the prediction of the change in residuals ® and the trend (d). The final value of y is the sum of these two values.

3. Triple smoothing (Holt-Winters model)

Triple smoothing additionally takes into account seasonal fluctuations.

Time series in demand forecasting, CC load, product recommendations and anomaly search

Formulas for triple smoothing.

ARIMA and SARIMA algorithm

A feature of time series for the application of ARIMA is the relationship of past values ​​associated with current and future.

SARIMA is an extension for series with a seasonal component. SARIMAX is an extension that includes an external regression component.

ARIMA models allow you to model integrated or difference-stationary time series.

The ARIMA approach to time series is that the stationarity of the series is evaluated first.

Next, the series is transformed by taking the difference of the corresponding order, and already for the transformed model, some ARMA model is built.

ARMA is a linear multiple regression model.

It is important that the series be stationary, i.e. mean and variance did not change. If the series is non-stationary, it should be reduced to a stationary form.

XGBoost - where without it

If the series does not have an internal expressed structure, but there are external influencing factors (manager, weather, etc.), then you can safely use such machine learning models as boosting, random forests, regression, neural networks and SVM.

From the experience of the team DATAX NUMBER, time series forecasting, one of the main tasks for solving the optimization of warehouse costs, personnel costs, optimization of maintenance of ATM networks, logistics and building recommender systems. Complex models such as SARIMA give high quality results, but require a lot of time and are only suitable for a certain range of tasks.

In the next article, we will consider the main approaches to the search for anomalies.

In order for the articles to be relevant to your interests, take the survey below, or write in the comments what topics to write about next articles.

Only registered users can participate in the survey. Sign in, you are welcome.

Articles on what topic you are interested in

  • Recommender systems

  • Image recognition

  • Speech and text processing

  • New architectures in DNN

  • Time series and search for anomalies

  • ML in business, use cases

17 users voted. 3 users abstained.

Source: habr.com

Add a comment