When AI says you have to pay more! (a.k.a Dynamic Pricing)

Moona Balghouthi
foobar Agency
Published in
8 min readFeb 2, 2024

--

I was walking into Lidl, one of the giant German supermarket chains that have branches in different European countries. I saw how the electronic price tags were being updated. Something I’d supposed that should have happened before the store opening. It made me think that we are trapped in these decision-making algorithms online and ”offline”.

Your data, your attributes (gender, age, geo-location, etc.), these loyalty points cards are just there to detect the patterns in your purchasing behaviors.

Electronic price tag

‍Another example was shown on the famous French news episode “LE20H” with the huge Auchan supermarket using image segmentation for stock computation to calculate trending products flying off the shelves or even better, to determine when to put those 20% discount stickers on strawberries.

AI to avoid waste

Probably one of the most famous examples of dynamic pricing is with flight bookings. I think it happened to many of us that we left a tab open to check it the next day, only to find out that the price had ‘surprisingly’ risen. Many people are sick of cookies popup windows and just accept them to get faster to the webpage they want. Yet, they don’t fully comprehend what tracking they are consenting to and how it affects them in the long run.

Viewing an item, clicking or adding to cart are all valuable actions that might classify you as a probably-converting user segment. Sounds creepy, yet, everything you do online is mostly tracked to study your behaviour pattern and use that data to know what you want and finally incite you to buy.

At least, I appreciate that some websites are straightforward about it. Try it on Google Maps: Search for a hotel in your desired location Then you’ll see at the bottom left a tiny text “About Pricing”, like in the screenshot below:

‍Once you click on the small circle information icon, it will land you here: You can see in the screenshot that the prices might vary according to the device type for example:‍

Let’s follow up with the hotels’ example by clicking on the booking.com link. When you open an accommodation page from the Google Maps view, your URL will contain tracking parameters that indicate your traffic source in your search journey. In this case, it comes from Google Maps website which is a comparison platform. A comparison website means that you are a price-sensitive user and you did see other prices from other providers. Yet, you clicked on this accommodation offer. In the screenshot below, I realized it was cheaper to open the same accommodation page from a Google Maps listing than a direct search on booking.com itself!

Price discounted coming from a price comparison listing

Price not discounted coming from the main booking.com search results page

Comparison website are normally in an affiliate program, so they are earning commission per sale. Hence, they can also reduce their commission and giving part of it to the end user by reducing the price or they have special deals due to the high volumes they are generating for the hotels.

However, reproducing such experiments is not consistent through different cities and dates. The pricing algorithm might consider different flags/parameters from one location to another. Some accommodation might not accept a high discount and set a maximum discount boundary. These restricting conditions falls within the business rules umbrellas. Business rules sometimes hinder the Machine Learning models’s predictions.

Yet, as a person who likes planning trips, it’s always worth testing to reverse engineer the pricing system and get a discount if you’re paying anyway.

I’ve even tried price comparison with ordering a ride with Bolt on an Android phone vs on an iPhone. Same time and itinerary, and yes, the iPhone app showed a higher price.

Can’t guarantee it would happen again but always worth testing.

Why? Because my user session data changes even if I create new accounts as well as the algorithms are continuously optimized.

In other terms, some apps might program their prices depending on how ‘rich’ you look. Owning an iPhone (device), living in an expensive city (IP address geolocation), your purchase history when you’re signed in to your favourite shopping site (your loyalty status) etc.

Unveiling the machine learning magic!

Dynamic pricing is an effective strategy to optimize revenue and profit margins in a dynamic market. However, to implement dynamic pricing effectively, businesses need accurate price predictions. Price prediction involves utilizing statistical methods and machine learning algorithms to forecast future prices of goods and services. These predictions are essential for businesses to make informed decisions about adjusting their current prices, maximizing revenue, and optimizing profit margins.

It’s not a secret that pricing strategies always had the supply and demand as main factors. For example, if a demand prediction model indicates an expected surge in demand, the dynamic pricing algorithm might adjust its parameters to increase prices slightly to capture additional revenue. Nevertheless, dynamic pricing system might have a cap to avoid excessively high prices that could lead to customer dissatisfaction.If a demand prediction model predicts a drop in demand due to a competitor’s promotion, the dynamic pricing system may adjust its rules to respond competitively. We would still need to implement upper and lower bounds on pricing changes to prevent extreme fluctuations that could negatively impact customer trust.

What AI brings to the table is revealing hidden patterns in data that can include internal and external factors, that one assumed it wouldn’t have a weight in the pricing equation.

Not just your individual attributes aggregated and clustered with similar user profiles. Supply, demand, competitors data from price comparison websites, macro-economic data, trendy searches in that time window, seasonality, campaigns (commercial festivities) etc.

There are so many variables in the equation that the impact differs from one business scenario to another. Diving deeper, The machine learning algorithms used for price forecasting in retail, e-commerce and the travel industry are similar to the ones used for general price forecasting.

Here are some of the ML algorithms frequently employed in these sectors:

Time Series Forecasting:

  • ARIMA (AutoRegressive Integrated Moving Average): Suitable for modeling time series data with seasonality and trends.
  • Prophet: Developed by Facebook, it’s useful for forecasting data with daily observations that display patterns on different time scales.

Regression Analysis:

  • Linear Regression: A simple yet effective algorithm for predicting prices based on historical data and relevant features.
  • ElasticNet Regression: Penalized Linear Regression that combines L1 and L2 regularization to handle multicollinearity in price data.

Ensemble Methods:

  • Random Forest: Combines multiple decision trees to improve accuracy and handle non-linearity in pricing data.
  • Gradient Boosting (e.g., XGBoost, LightGBM): Boosting algorithms that can capture complex patterns in price data.

Time Series Neural Networks:

  • Long Short-Term Memory (LSTM): A type of RNN designed for sequential data, often used for time series forecasting.
  • Gated Recurrent Unit (GRU): Another RNN variant, suitable for time series data forecasting.
  • SARIMA (Seasonal ARIMA): An extension of ARIMA that includes seasonal components, making it well-suited for price data with recurring patterns.

Proximity-Based Algorithms:

  • K-Nearest Neighbors (KNN): Predicts prices based on similarity to historical data points.
  • Density-Based Spatial Clustering of Applications with Noise (DBSCAN): Can identify clusters of similar price points and make predictions within clusters.

Reinforcement Learning:

  • Q-Learning: Can be used to optimize pricing strategies over time by learning from past pricing decisions and their outcomes.

Hybrid Approaches:

  • Combining multiple algorithms or approaches to improve forecasting accuracy, such as combining time series forecasting with regression.

The choice of algorithm depends on the specific needs and characteristics of the pricing data in each industry. It’s common to experiment with several algorithms and select the one that provides the best results for a particular use case. Additionally, feature engineering, data preprocessing, and model tuning are critical aspects of building effective price forecasting models in these industries.

Many challenges can arise. We can mention a couple of examples:

  • For entire times series, we might realize that there are many missing data points. This can be on product level or on a customer level. For example, the product is a new entry in the catalog or hasn’t made any sales for the last x months. In this case clustering similar products might be a good approach. Let’s say we’re trying to predict the price of a new bus journey between 2 villages. We can add this route to a cluster of similar bus routes who have similar km distance, travelling hours and start/end points populations. (e.g using K-means clustering). Another example is when we have a winter cap of a certain brand. This can be in a sub-category under another category of clothing in tree-like dendogram structure. (e.g using Hiearchical clustering). In these examples, we can leverage the historical pricing data of the other products in the same cluster to make predictions for the new product. This implicitly assumes that products in the same cluster might exhibit similar pricing patterns.
  • In some cases, multivariate time series forecasting is not performing as well as univariate. One approach is to do a two-step approach with first using a univariate prediction model for one variable. Once we have the forecasted values for the initial variable, we can then use these forecasted values as inputs in a regression model. The regression model is then applied to predict the values of other variables that are dependent on the first variable. Essentially, the idea is to capture the relationships between the variables using regression.
  • Prediction of prices might depend on time. One can partly tackle this by taking into account anticipated seasonality and trends. However, there still can be unexpected events that influence customer’s purchase behaviour like boycott campaigns or wars that impacts the economy in different countries.
  • As there are many influencing factors, we might end up with too many features. A high-dimensional dataset makes it difficult to the model to distinguish noise from trend. That’s why feature selection is an important step in data pre-processing.
  • Between the predictor features and the price, there is a correlation but not necessarily a causality. For example, in Valentine’ day, between wearing red outfits and chocolate sales increase there is a correlation but not a causality. Whereas, chocolate sales increase and flower sales increase can indicate a causality as many shops combine them both in bundle offers. Identifying true drivers of price fluctuation is not straightforward.

Through this article, we can see that the concepts of dynamic pricing and price prediction are connected. On one hand, price prediction provides the foundation for implementing dynamic pricing strategies, allowing businesses to make data-driven decisions about price adjustments.
On the other hand, dynamic pricing, by constantly adapting prices to market conditions, generates new data that can be fed back into price prediction models, improving their accuracy over time.
In conclusion, dynamic pricing is not just about algorithmic calculations. It’s a strategy that adapts to ever-changing market conditions and consumer behaviors, underpinned by sophisticated ML models.

Last but not least, you must be wondering if we can really avoid these pricing traps as consumers? It’s hard. You might be involved in a customer segment of an A/B test and you won’t even know it.

--

--

Moona Balghouthi
foobar Agency

Software Eng~Data Scientist, Into People, Social Entrepreneurship & Adventures !