The Ins and Outs of Using Machine Learning for Sales Predictions

Machine learning helps retailers to automate the monitoring of competitors' prices, forecast demand and predict sales. Usually, to come up with a data-driven roadmap and develop demand forecasting it’s essential to understand the workflow of ML modeling.
7 min read
All articles
By Denis Baranov
Head of Retail & Distribution Practice
The Ins and Outs of Using Machine Learning for Sales Predictions

According to a survey of 1000 organizations around the world, 78% of companies are introducing machine learning (ML) in order to increase operational efficiency, 75% — to increase customer loyalty, and 79% — to analyze data and uncover new ideas. But how does ML do all of this?

Data Is the Key

Self-learning algorithms process large amounts of data, remember successful and unsuccessful decisions, and then use this information in future forecasts. Algorithms are trained on historical data: transactions, the history of interactions with customers, internet sources, revenue information, and so on. The data set, quality and duration of the period over which they are collected determine how accurate the model will eventually be. The algorithm works by finding patterns in the data array, monitoring how and why various factors influence the process of interest changes, and spotting non-obvious patterns faster than a team of analysts ever could.

Here’s an example: a store collects purchase information over several years. The system analyzes this data and finds various patterns: how consumer demand depends on the season, which customers buy new goods, and the impact of discounts and other factors. Based on this, the algorithm makes a prediction: the quantity of goods that needs to be purchased by retailers in the next week, month, or year.

6 Questions to Define Your ML Needs

Every ML algorithm starts with the collection of data. Then an ML programmer simulates it, potentially determines that there is insufficient data, and returns to collecting. The simulation/collection cycle is repeated until enough data is gathered, and then the programmer finds a good model and deploys it. If it does not work, the programmer creates another model, deploys that, and tests it; and so on, until a proper working model that fits the data can be found. Creating an ML algorithms is an ongoing cycle, and it is important to answer the following questions before starting:

  1. Target Definition. What business problem are you trying to solve? How can this be formulated as a machine learning problem?
  2. Data. What data do you have? How does this fit the definition of the task? Is the data structured or not? Is the data static or streaming?
  3. Evaluation. What determines success? Is the machine learning model good enough with 95% accuracy?
  4. Features. What aspects of the data will be used for the model? How can what is already known affect this?
  5. Modeling. Which model should you choose? How can you improve the model? How do you compare it to other models?
  6. Experiments. What else can you try? Does the expanded model work as expected? How do other steps change, depending on what you find?

The Steps of an ML Workflow

The Ins and Outs of Using Machine Learning for Sales Predictions

Step 1: Data Collection

From the company’s perspective, the most difficult stage is collecting and preparing the data. In order for ML to work, a lot of sales data is needed.

This data can be located from different sources (such as ERP, CRM systems, external sources among others). It is also possible to get information on sales-influencing factors, for example geographical region, ongoing marketing campaigns, exchange rates, season, and so on. These additional factors can affect the accuracy of the forecast.

In most cases, part of the data will be used to train the model, and the rest will be used to verify the result, by comparing the predicted sales volumes with the existing data.

Learn more about ML for your business

Step 2: Data Preparation

After collecting training data, the next step is preparing it: downloading the data to a suitable location and sorting, cleaning and modifying it for training.

First, all of the data must be collected, and then its sequence is randomly changed so that the order does not affect the learning process. It must also be split into two parts, as mentioned above. The optimal ratio for training/verifying data is 80/20 or 70/30. It is important that data is not repeated in either part.

Step 3: Choosing the Right Model

When choosing a model, the following parameters must be considered:

  1. Accuracy. The result with maximum accuracy is not always optimal. In some cases, it is more appropriate to use approximate values that significantly reduce processing time.
  2. Studying time. The amount of time required to train the model depends on the algorithm chosen. Generally, the lower the accuracy, the less training time. Some algorithms are more dependent on the amount of data than others, and this can significantly affect the choice of algorithm for the model, especially when time is limited.
  3. Linearity. Most ML algorithms are linear — that is, data classes can be separated by a straight line. For some problems, linear algorithms work well, but, for others, they significantly reduce accuracy.
  4. Number of parameters. The number of parameters, for example, the number of iterations required or its sensitivity to errors, directly affects the behavior of the algorithm. Usually, the larger the number of parameters, the greater the number of attempts and errors on the path to finding the best combination.

Step 4: Model Training

To train an ML model, the following must be specified:

  • Data source for training
  • Name of data attribute that contains the target to be predicted
  • Required data transformation instructions
  • Training parameters to control the learning algorithm

Step 5: Verification of the Result

After a model is specified, an assessment can be made, and adjustments should be performed to achieve the accuracy that suits the company. Once this accuracy level is attained, the predictive model can be published in the form of an accessible web-service. Its role is simple: it receives data as an input (for example date, store, forecast exchange rates, product type, and so on), and it outputs forecast sales amounts.

Typically, various regression algorithms are used to build a sales forecast, but other methods can also be used, depending on the exact goals and which model gives the highest accuracy. Algorithms also can be combined.

After evaluating the performance of the model, it is easy to see if it can be improved by adjusting the parameters. In addition, it is usually necessary to run a model through the training data several times to improve accuracy.

Improve sales with prediction algorithm

Sales Prediction Case Studies

Case Study 1: Sales Forecast

The algorithm finds and measures all the relationships between products, analyzes past sales data and then models the effects of various factors on sales.

For example, this model can predict how a discount on product X will change sales of similar products, or how cold weather will affect sales.

Case Study 2: Price Optimization

The algorithm predicts the best prices for the retailer, taking into account customer demand, competitors’ prices, warehouse issues, the delivery date of the next batch of products, sales speed and other factors.

For example, the algorithm is able to calculate that a watch of type X costs between $80 and $150. Knowing these boundaries, the retailer determines the optimal cost of the goods, taking into account their business goals.

Case Study 3: Customer Segmentation

In retail, customers are categorized by age, income level, social status, and interests. ML allows one to combine customers into groups using implicit patterns, for example, people who are prone to impulsive purchases of proposed extras, who have a high salary, or who have two kids. This categorization can help retailers to form a very accurate profile for their customers, with a view to optimizing discounts.

Talk to our Expert about ML

Case Study 4: Marketing Optimization

Algorithms help to remove unnecessary promotions and strengthen work on those that bring results. They can analyze previous promotions and choose combinations such as place/product/discount in order to fulfill the desired goal: expand the market, increase profits or attract new customers.

For example, marketers can more accurately target users who are interested in them.

Case Study 5: Merchandising

The analysis of information from video surveillance systems helps to understand how people move around a store, how location affects the purchase of goods, which counters and display cases are of the greatest interest, and so on. Retailers can create «customer journey maps» for priority sales areas.

For example, by comparing the data obtained from shelves and display cases, promotions and other factors, the system can determine where to place different groups of goods.

Sign Up for Updates!

Subscribe now to receive industry-related articles and updates

Choose industries of interest
Thank You for Joining!

You will receive regular updates based on your interests. No spam guaranteed

Add another email address
Sign Up for Updates!
Choose industries of interest
Thank You for Joining!

You will receive regular updates based on your interests. No spam guaranteed

Add another email address
We are glad you found us
Please explore our services and find out how we can support your business goals.
Get in Touch Envelope