Dynamic pricing is an essential tool for modern e-commerce, allowing us to adjust prices in real time to achieve business targets. With the most recent developments in machine learning, this process has become more accurate, flexible, and fast: algorithms analyze vast amounts of data, glean insights from the data, and find optimal solutions.
In this article, I explain how ML helps in price management, what technologies are used, and why sometimes simple models outperform complex ones.
Although each company has its strategies, adjusting is necessary due to the influence of external factors. Before introducing machine learning, companies managed dynamic pricing through their analytics departments and internal expertise. Analysts built price elasticity models based on price, discounts, and customer behavior. Using this data, they determined how customers reacted to different prices and constructed robust elasticity curves to select optimal pricing points. However, evolving market realities demand swift responses from companies, and dynamic pricing has become a powerful tool to meet these challenges.
Arc-Elasticity of Demand. Image credit: economicsdiscussion.net
The Transformation with ML
The dynamic pricing landscape is very different now. Machine learning has produced more nuanced models that adjust prices with greater precision and responsiveness.Â
These models are susceptible to changes and can identify where to apply larger or smaller discounts, markups, loyalty points, and coupons. Plus, ML models provide justifications for these decisions. ML can use extensive sales data, often spanning two to three years, to create incredibly detailed elasticity models for broad categories and specific brands or even smaller subcategories. Instead of relying on a general model for products like phones, ML allows for individual models for brands like iPhone or Samsung and even for specific items like batteries or chips.
Companies can also respond to market fluctuations and consumer behavior quicker because ML allows for near real-time price adjustments. Prices can be recalculated several times daily based on factors such as the number of unique product views. This rapid adaptation ensures that pricing strategies align with current market conditions, making the process more flexible and accurate over short and long periods. This responsiveness differs from the analytics approach, where these models are sometimes updated monthly or bi-monthly.
Of course, using cutting-edge tech is not enough to guarantee success. Companies are constantly refining their approaches to dynamic pricing by developing specialized architectures and methodologies. For example, a company has used reinforcement learning techniques, such as the ‘multi-armed bandit’ approach. While this method has been shown to work in other areas, such as in recommendation systems, it has also proven effective in dynamic pricing. It allows the system to simultaneously explore pricing strategies and quickly find the most effective ones.
Main Stages of Machine Learning in Dynamic Pricing
Data Collection and Preprocessing
The first step is gathering comprehensive data on products, prices, sales, and customer behavior. This includes historical sales figures, pricing history, inventory levels, and external factors like competitor pricing and market trends. Given the enormous volume of information – which can reach petabytes – efficient data handling is crucial. Tools used for data preparation differ based on the data’s volume and complexity:
- Pandas: A Python library suitable for data processing in smaller projects or prototyping the big ones.
- Spark or Ray: Frameworks used for distributed processing of large datasets.
- Polars or Dask: Allows for efficient data loading on local machines without exhausting memory resources.
Modeling and Prediction
Next is modeling, where elasticity curves or other models are built to predict target metrics such as turnover, profit, number of orders, or customers. The models then make predictions about the expected results at different price points. For example:
- At price X, sales are projected to be $100.
- At price Y, sales are projected to be $50.
- At price Z, sales are projected to drop to $20.
The optimization algorithm determines the optimal price changes needed to achieve the business targets based on these predictions.
Machine learning for dynamic pricing uses technologies and areas of knowledge, such as macroeconomic principles, to construct elasticity curves. The main tasks involve data processing and preparation. An interesting aspect is that models often operate at the category level rather than on individual products. This is because products and sellers can quickly appear and disappear from the platform. For instance, a model might analyze the “phones” category rather than individual smartphone models.
Further Steps in Dynamic Pricing
Price Optimization
After modeling and prediction, the complex task of price optimization begins to meet business targets. The essence of the task is to determine the optimal price for each product so that the overall changes align with specified business metrics, such as increasing turnover by 10% while limiting profit reduction to no more than 5%. This includes optimizing multiple functions, each corresponding to a category or product. For example:
- Phones: The first function, where the input is the price of a phone (e.g., $100).
- Furniture: The second function uses the furniture price as the input (e.g., $50).
This multidimensional optimization problem requires advanced techniques to handle the scale and complexity.
Key steps include:
- Mathematical Modeling:
Develop models integrating business constraints (e.g., profit margins, sales targets) and objectives.
- Optimization Methods:
Apply advanced techniques to solve the problem even with millions of variables.
A variety of tools and methods are used to handle price optimization:
- Python Libraries (Hyperopt, Optuna, Vizier)
- Mathematical Methods (Lagrange Method, Penalty function methods)
Finding the best solution in terms of markups corresponds to finding optimal points on the optimization plane // Vi. Image credit: LinkedIn
Testing and Validation
After effectively managing elasticity curves, machine learning models focus on meeting specific business objectives. For example, a company might have a baseline strategy, such as a 2% markup on all products. Analysts may propose improvements, aiming to increase turnover by 10% and profit by 2%. The challenge for the model is to surpass this baseline and deliver better results.
Companies use A/B testing to determine a statistically significant effect. This process begins with preparing an analytical report that defines target metrics such as turnover, profit, and number of orders and sets the minimal detectable effect (MDE)—the smallest effect size that can be statistically detected. For example, if the MDE is 2% and the increase in the metric is 1%, the 1% could have come from random fluctuations. Overcoming the MDE provides evidence that it is not random. Â
Analysts also assess other metrics, such as promotional efficiency, and calculate the turnover each promotional spend generates. If every unit invested yields two turnover units, it’s viewed favorably. A/B testing and analytical reports verify the model’s effectiveness and measure its impact on key business metrics.
After deploying the ML model, it runs in production for a designated period while monitoring performance. It’s crucial not to interrupt or prematurely examine test results to ensure objectivity. After completion, machine learning engineers review all metrics to evaluate how well the model aligns with real-world performance. If results are unsatisfactory, they investigate potential issues such as data preprocessing errors, incorrect model assumptions, or algorithm problems. For instance, the model might have increased phone prices, leading to decreased sales compared to the control group. This rigorous testing helps identify and correct mistakes, ensuring the ML model effectively contributes to achieving the company’s business targets.
The conclusions drawn from testing help understand the model’s manageability. For example, if the goal is to increase turnover, the model should consistently meet that target. Initial test results may be erratic, but the model demonstrates the expected performance over time through improvements and knowledge gained from testing. Machine learning allows for more frequent testing and updating of models than manual analytics. For instance, Amazon recalculates prices every hour, highlighting ML’s agility in dynamic pricing.
This real-time adaptability manifests in practical ways. On some platforms, prices may depend on variables like the number of unique views a product receives, leading to multiple price changes within a day. If a company runs long-term promotions, prices might be fixed for the campaign’s duration, focusing solely on achieving current business metrics like turnover growth or customer retention. ML makes the pricing process more flexible and manageable from a business perspective, but the ‘black box’ effect disappears.Â
In simple terms, a business presents a target — for example, to increase revenue by 2%. The ML model then employs various strategies to achieve this objective. These strategies might include lowering prices to boost turnover, raising prices to enhance profit margins, offering discounts, or adjusting prices based on factors like product views. The model manages the process based on proposed hypotheses, continually refining its approach to meet the specified targets. This dynamic adaptability underscores ML’s significant role in modern dynamic pricing, enabling businesses to respond swiftly to market shifts and consumer behaviors.
Dynamic Pricing in Action
Machine learning is essential in modern dynamic pricing, enabling businesses to adjust prices with greater precision and responsiveness to market demand and consumer behavior. By processing vast amounts of data, ML models identify patterns that inform optimal pricing strategies, helping companies meet specific objectives like increasing profit turnover margins. Price adjustments have reached a new level of accuracy. Companies embracing these technologies are better equipped to deliver value to their customers while achieving their business goals. Everything has shifted from a reactive to a proactive, highly efficient strategy.Â
Integrating ML isn’t without its challenges, but as seen in major platforms, the rewards are undeniable. As the field continues to evolve, machine learning will remain at the core of dynamic pricing, driving more intelligent decisions and better outcomes for businesses and consumers. So, it is a strategy that certainly deserves attention.