Alexei ChernobrovovConsultant on Analytics and Data Monetization

How Machine Learning helps in setting correct prices

In the article we will discuss the task of the effective market pricing using Machine Learning (ML) considering the example of babadu.ru – russian toys internet-store that is in TOP-100 of the biggest online-resellers in Russia [1].

Effective pricing is the pricing algorithm that satisfies the following conditions:

  • compliance with business strategy;
  • the ability to analyze situations ("what if ...");
  • regularity of updating all prices;
  • the lack of increased costs for the process of updating prices.

In reality, various prices are often set for exactly the same products in different places. This is due to the fact that the share of service is often more than 30% of the value of the goods. A classic example: when buying a cup of coffee in a restaurant, you pay  for the product itself no more than 3% (grain + water), and everything else is a rent for space, a beautiful view from the window, logistics for delivering grains, roasting and cooking processes. As well as the salaries of waiters, bartenders, musicians, etc. Thus, the "service" is in any product. It is this component that determines the difference in the price of identical goods.

A little bit of history

Most of goods are bought today from the Internet. Even in offline-shopping we know all prices of the product in different shops. However, now with the development of the IT and Data Science in particular, the price of goods in online-stores is becoming subjective for each customer. This phenomenon is called a dynamic pricing.

Historically, economics have determined the price. For example, 30 years ago in the CIS people brought goods from China and sold them at the price that was 5 or 10 times higher than the original. Sociology played a small role: big brends examined the price preferences of different focus-groups. It is from here that traditions, caused by psychology, about the effectiveness of “uneven” numbers in prices (for example, 999 instead of 1,000), as well as yellow price tags that mean a discount, came from. Statistical approaches were practically not used, since at least in the CIS the market economy was at the formation stage at that time: when the market grows at an insane pace the price of a unique product can be absolutely arbitrary.

About 10 years ago the term ‘marketing’ became popular. It summarized the accumulated techniques of sociology, psychology and statistical knowledge of pricing. It was then that airlines first began to engage in dynamic pricing, playing on the securities market and predicting oil prices to determine the future value of the flight. These attempts to forecast prices with the help of ML were picked up by resellers, since the cost of goods includes the cost of air travel. Here, the most striking precedent was the price discrimination from Amazon, when in 2000 the online trading giant offered to different categories of buyers the same DVD-films at various prices [2]. Price discrimination, when, for example, all goods are offered at 100 rubles, and for you personally at 110, is considered illegal and unethical. The legal alternative to this is dynamic pricing, when the goods are sold to everyone at 100 rubles, and to you personally - at 90 due to the discount.

Dynamic pricing depends on different parameters, for example, days of the week, time of day, season, availability of goods in stock, demand or price from competitors. Such simple models are often used in the ticket selling, for example, for Russian Railway trains. In the case of Amazon, described above, the cost of goods has depended on the time of the day and the price of competitors (Fig. 1).

Fig. 1. Changing in the price of the same goods in online stores, depending on the time of the day [3]

 

Today, more complex pricing models are applied that are based on the analysis of different factors with the help of ML-algorithms. Before moving on to them let us consider the mathematical formulation of the problem.

Effective arketing: psychology against mathematics 

In terms of mathematics the problem of pricing is in finding the optimal point on the curve of the arc from the purchase price to the highest possible price. In economics, this arc is called the demand and supply elasticity curve, and in mathematics it is called the reference trajectory. The reference trajectory is a convex function [4], for which there are many ways to find the optimum - it is at the top of the parabola and is the best price (Fig. 2).

Fig. 2. The mathematical illusion of the problem of pricing

 

However, the practice and the theory are different. Let us consider a simplified example of why in reality the dependence of profit on price is not always a convex function. The classic case that confirms this was about large flower shops: the experiment has been raised on two bouquets. There are 2 bouquets of flowers: the first costs 2,000 rubles, and its purchase price is 1,500. The second is sold at 3,500 rubles, and purchased at 3,000. During the day 3 copies of the first bouquet and 8 copies of the second were sold. Further, the price of the 1st bouquet was increased to 2,500 rubles. Sales of the 1st bouquet fell: only 1 was sold. Sales of the 2nd, the price at which did not change, remained at the same level: 8 units per day. Total profit declined. When the price of the first bouquet was raised to 3,300 rubles, 3 people bought it. At the same time, sales of the 2nd bouquet fell to 5 units, although its price remained unchanged - 3,500 rubles. Thus, the total profit reached the maximum of these 3 options: 7,900 rubles (Fig. 3).

Fig. 3. Statistics of sales at different prices: the search for elasticity

 

The reason for such results is the psychology of consumers. This floristic store had a specific consumer audience: 8 people who bought bouquets in the region of 3,000 roubles, and a small group that bought up to 2,000. After changing the price range of one bouquet these products began to compete with each other.

Therefore, when searching for the best price, you should not just look for the optimal point on the elasticity curve, but take into account additional information about the goods. For this example, this is the budget of the potential buyer and the number of bouquets of each type. Based on these two parameters, a model was built that accurately describes the probability of a purchase. As a rule, the purchase price is unknown to the customer. Thus, cheap goods for purchase can be very profitably sold.

There is another method of increasing the total profit by means of changing prices on goods. It is called ‘anchor’, because it is based on products-anchors. Anchor is the main product for which the customer came, the rest of the amount in the consumer basket is made up of additions to it. The classic illustration - a phone and accessories to the phone: cases, screen protectors, stickers and ect. Let us consider an example when the internet-store have been selling phones for 10 500 rubles, earning a little on the device itself and its accessories. As part of the campaign, the price of the phone was reduced by 5% and became the lowest price in the market. The orders were increasing, the total profit also increased, although the main product was sold “at zero” at the purchase price (Fig.4).

 

Fig. 4.The example of increasing the total receipts by lowering the price of the ‘anchor'

 

Thus, from the point of view of business it is not necessary to search mathematically the optimal price, we need to build such a price series in order to increase profit in general (Fig. 5).

Fig. 5.The mathematical formulation of the problem of pricing (maximizing total profit) from the point of view of business

 

It is necessary to determine the dependence function of the number of sales on prices, taking in concern the context of the task and price of experiments. At the same time, the desired price sequence may converge to an optimum for a very long time. From a mathematical point of view, it can be a very slow algorithm, and the desired function itself is not Markov, i.e. its value depends on previous states, and not only on the current value of independent variables [5]. Thus, in reality, the functional should be optimized at the same time and the function of elasticity should be sought. In this article, we are considering one of these possible approaches.

Preparing for modeling

First of all it is necessary to prepare for simulation, to think about all business like moments: 

  • prices should not be changed often in order not to confuse consumers;
  • the cost of goods should not be changed several times.

So, we started pricing with ML in the internet-store. Firstly, the matching of goods was done. It was a very long and laborious process, because for every product its background should be taken into account. For example, if previously the toothbrush A was sold, later was released A1 (its new version), it is necessary to take into account the background of selling the toothbrush A in the history of A1, because both products belong to the same categories, are in the same price range for the same target audience.

But for example in the case of Apple phones it is necessary to change the segment of the product: with the release of the 5th model, the 4th wasn’t stopped selling, but it switched from a luxury group to a class of cheaper goods. It was not possible to fully automate that complex task, it was necessary to compare and prescribe some rules manually.

Next, a special metric was defined that characterized the goods in each group and was automatically recalculated for clustering by price elasticity. For example, a toothbrush, a box of chocolates, and soft toys can fall into the gifts category. The change in prices immediately affects the entire cluster so that goods within the same category do not compete with each other. Anchors and additions were also identified. For example, an anchor is a bouquet of flowers, and an addition is a box of chocolates or a small soft toy. But the same soft toy of larger sizes cannot be an addition, it is a separate purchase.

Next, an analysis of search traffic was performed to predict the demand for goods. This rather simple task is solved with the help of site counters: Google Analytics, Yandex.Metrica. After that, a support demand function was built - a sales forecast with recalculation of each commodity cluster. To approximate elasticity, a regression approach, random trees (Random Forest) and gradient boosting (Gradient Boosting) were used. A separate model was used for each cluster: averaging, weighted voting, etc.

Finally, an adaptive choice of the step of the change in price was made. To do this, it was necessary to solve the problem of increasing the target functionality, limited by the risk of deterioration of specific indicators (total profit, product category revenue, etc.). If prices change in a very big step, this will scare off users and sales will fall catastrophically. And if the step is too small, the user will not notice a change in prices, which will not lead to significant and positive results.

Realization of ML-models and algorithms

The developed ML-model gives the product identifier and margin as a percentage at the output, since it is easier for the client to set prices. If the purchase price has changed, the new value is calculated automatically. The algorithm is able to count 60 thousand prices in 3 hours. This speed is achieved through clustering. For example, if you need to update the cost in 10 clusters, this will be done in just 5 minutes due to the anchors and their connections between themselves and accessories.

Note that the concept of anchors for business and for consumers is different. For example, for the whole category "Toys" there can be only 1 or 2 large anchors that are needed, including in order to place similar products in the clusters as far away from each other as possible. Thus, our model seeks cluster elasticity in contrast to a typical recommender system.

Due to clustering, many optimal points are obtained at once. For example, there is a cluster of 100 different plush toys. This is one point in the cluster. Dividing the cluster in half, we get 2 more points with close elasticity. Due to hierarchical clustering, the function is weighted by different coefficients. Thus, the pricing function will be approximated by three points.

Hierarchical clustering is achieved through a detailed description of the goods, i.e. a complete set of their characteristics. For example, in the category "soft toys", "bear" is a characteristic, 16 centimeters (bear length) is also a characteristic. It is necessary to distinguish metrics-characteristics so that products with similar values would be as close as possible in price elasticity. If the product is an anchor, it should be propagated and added to another cluster, since it leads to the sale of additions (Fig. 6).

Fig. 6.The example of cluster classification by anchors

 

In addition, our weighted boosting algorithm takes into account the impact of seasonality on pricing. For example, on May 9, sales are falling, as people go to parades and parks, not shops. Therefore, these signs were manually added to the ML model: holiday, day before the holiday, etc., all that can be obtained from the time series - the calendar. Thanks to this, the model takes into account the seasonal drop in search traffic, conversion and, accordingly, sales.

The results of the ML implementation for pricing

The approach that was described above and ML-models were implemented in babadu.ru, a large domestic online toy store [1], which is included in the top 100 of the Runet and has an annual turnover of more than a billion rubles.

The goals were set to increase revenue and marginal income. These indicators have managed to increase by 7% due to dynamic pricing using ML in just a few weeks (Fig. 7).

 

Fig. 7. The results of testing the ML-pricing system in a real online store

 

One of the reasons of such a quick and tangible achievement of the goals is the increase in the minimum resale price (MRP). MRP is the lowest price at which a product is sold on the market. It is impossible to sell the product lower than the market MRP, but possible to sell more expensive. However, in reality resellers try not to exceed the MRP in order not to scare away buyers by selling goods at a cost higher than the competitors have.

However, our algorithm found some hidden pattern in the sale of goods from MRP. It showed that it is possible to increase the price of the goods, thus increasing the target indicators (total receipts and marginal income). At first, the customer was afraid to do this, but as an experiment after the first week of the successful operation of the ML system, it was decided to increase the cost of goods from the MRC by 1,500 rubles. According to the ML forecast and contrary to the negative expectations of the customer, sales of these products did not fall, but remained at about the same level. This is due to the traffic channel: these products were mainly purchased through e-mail newsletters. Buyers were loyal to the store and almost indifferent to the cost of the product. So the ML system earned 200,000 rubles for the store in a week (Fig. 8).

Fig. 8. The results of selling goods at a cost higher than the MRP 

Conclusion

So, ML technologies have once again proven their worth in the field of online commerce. However, before implementing this approach, the following conditions must be met:

  • business volumes require automated data processing, for example, setting prices manually for 10-100 items is a matter of a couple of hours. And in the case of an assortment of several thousand products, taking into account their relationships, it is almost impossible for a person to independently update the cost of each product.
  • there are additional analytics tools (metrics for counting website visitors, sales statistics, product categorization, etc.);
  • the expected effect of the implementation of ML exceeds the total cost of preparatory work (product matching, hypothesis development, implementation of the system and labor costs of specialists).

Subject to these conditions, well-coordinated work of ML-specialists with the business and readiness for changes, positive results will not be long in coming.

Sources:

  1. ТОP-100 list of the biggest online-stores in Russia
  2. Is the price discrimination valid?
  3. How Does Dynamic Pricing Work? Examples, Strategies, and Models
  4. Convex Function
  5. Markov Chain

 

Contacts