You are on page 1of 16

Price Optimization with Machine

Learning: The Impact of Data


Science on Commercial Strategies
Ismetgocer · Follow
Published in Academy Team · 10 min read · Dec 11, 2023

220

Nowadays, the impact of data science and especially machine learning in the
business world is increasing. One of the most obvious examples of this effect
is experienced in the field of price optimization. Pricing strategies are a
critical factor that directly affects the revenue of any business, and
optimizing these strategies is one of the keys to surviving in a competitive
market. The integration of machine learning technologies in this field both
strengthens data-driven decision-making processes and enables businesses
to adapt to market dynamics more quickly and effectively.

In this article, we will examine in detail how machine learning is integrated


into price optimization processes and the advantages this integration
provides for businesses. First of all, we will focus on the basic principles of
price optimization and its importance in the business world. Then, we will
discuss the applications of machine learning techniques in this field with
real-world examples. In this process, we will cover each of the steps in detail,
such as data collection, processing, modeling, and evaluation of the results.

The application of machine learning to price optimization provides


significant contributions to businesses not only in determining prices, but
also in areas such as understanding customer demand, competitive analysis,
and following market trends. This article aims to provide an in-depth look at
how this complex process can be managed and how machine learning
techniques can provide a competitive advantage to businesses.

This article will discuss the opportunities and challenges that the integration
of machine learning into pricing strategies offers for businesses from an
academic perspective and applied examples and will provide information
about the latest trends and best practices in this field. In this study;
Mathematics, economics, econometrics, and machine learning information
were used together. In this respect; It is an enjoyable and fully
interdisciplinary study.

Price Optimization; In economics, it is generally analyzed with an inverted


U-shaped price-income curve (Ruparelia, Pezzuli, and Looft, 2022).

Chart 1: Relationship Between Price and Income


Source: Kulkarni (2022).

This curve states that as the price of the product increases in the first period,
the seller's income will also increase, but when the price continues to
increase after a certain optimum level, customers will leave this seller and
therefore the seller's profit will decrease (Clarkson and Black, 2016).

The inverted U-shaped relationship in Chart 1 is frequently used in


economics to explain different events, some of which are:

Laffer Curve: The relationship between tax rates and the tax revenue that
the state can collect (This view was first expressed by Ibn Khaldun (1332–
1406))

Kuznets Curve: The relationship between national income per capita


(GDPPC: Gross Domestic Product Per Capita) and income inequality
(GINI)

Environmental Kuznets Curve: The relationship between national


income per capita (GDPPC) and environmental pollution (Carbon dioxide
(CO2) emissions)

The inverted U-shaped curve seen in Chart 1 is a parabola in mathematics


and is modeled using the following equation:

If a<0 in Equation (1), an inverted U-shaped parabola will appear.

If we adapt this equation to the price (Prices: P) - income (Revenue: R)


relationship;

If we want to write this in the econometric form that we will use in Machine
Learning analysis;

We will use mathematics to find the optimum price level in Equation (3). We
know from mathematics that at the vertices of the curves the first-order
derivative is equal to zero (i.e. the slope of the tangent at this point is zero):

If we equate this obtained equation to zero;


happens, hence when P is left alone;

This P value obtained is the optimum price level that maximizes revenue.

Equation (3) can also be expanded with other explanatory variables that are
deemed useful to include in the model. These can be briefly indicated by X;

When the partial derivative of Equation (7) is taken concerning P and set
equal to zero, the resulting P ( the P value in Equation (6) ) will be the
optimum price level. That is, at this price level, the seller's profit will reach
its maximum level. If the seller wants to increase prices even further, he will
start to lose customers and his profits will tend to decrease.

Application of Price Optimization in E-Commerce


In this study, price optimization will be discussed practically based on the
data of an e-commerce company that does dropshipping through Amazon.
It was prepared using DALL-E and with additions made by the author.

In this context, when Equation (7) was expanded with e-commerce data of a
product of the relevant company, Equation (8) was obtained:

Here:

R: Revenue is the amount of income or profit that the seller will earn.

P: Price, that is, the sales price of the product


Q: Quantity, that is, the amount of sales realized at price P

BSRSub: The best sales rank in the subcategory of the product (Best Seller
Rank)

Seller Numbers: Number of different sellers selling this product

Rating: Average score given to this product by customers, ranging from 1 to 5

Review Numbers: Shows the number of comments made by customers


about this product.

The profit (R) used in Equation (8) can be calculated with the help of
Equation (9):

Revenue = Sales Price — Cost………………………………………………………(9)

Note: Here “Revenue” represents the profit.

Equation (9) can be represented more briefly as Equation (10):

Here;

A: Cost is the cost and is calculated as follows:

C = The purchase price of the product from the USA (from Amazon.com) +
The handling fee that the intermediate warehouse will receive for changing
the label of the product and sending it to the final buyer in Canada + The
average 15% service fee that Amazon will receive (Amazon Fee )..……….(11)
An important point to note here is; This is because Amazon Fee is calculated
on the final sales price, including the seller's profit.

In this study, Profit (R) was calculated using Equation (10) and Equation (11).

Note: When the data were used as P and R, since an inverted U-shaped
relationship could not be detected between these two variables, the P
component of the analysis was transformed into Q*P, or simply QP. Thus, the
turnover (total money entering the cash register) is included on the
horizontal axis, not the price. In this case, equation (8) was rearranged to
obtain Equation (12):

After Equation (12) was estimated, the partial derivative was taken over the
QP variable.

The QP obtained here is; It gives the optimum turnover, and when this value
is divided by the number of products, the optimum price per unit product
will be reached.

Since this study was conducted on a product basis and in time series form,
Equation (15) was obtained when Equation (12) was written in the form of a
time series econometric model:
Equation (15) was used in the Machine Learning phase.

Machine Learning Phase*


* The data set and notebook used here can be accessed at
https://github.com/ismetgocer1/Price_Optimisation_Machine_Learning .

In the first stage of Machine Learning, to transform the data into similar
sizes and ensure that the model gives equal importance to these variables
(otherwise, machine learning algorithms may tend to give more importance
to features containing large numbers) and thus prevent the results from
being biased. The scaling process has been applied. In this context; the
standard scaler method was preferred. Standard Scaler; It is a method
applied to prevent the ML model from giving more importance to series
containing large values by rearranging the values of the series so that the
mean is 0 and the standard deviation is 1. As a result of this process; All data
used in the analysis become of similar numerical size.

Note: An important point to remember here is; If the series are subjected to
scaling from the beginning, when interpreting the findings (coefficients)
obtained as a result of the analysis, the data must be converted to their
original state by performing a reverse scaling process. Another important
point is that if predictions are to be made with these models (that is if
predictions are to be made for observations), new data must also be
subjected to the same scaling process (or even if we go into more detail, they
must be subjected to scaling that is trained with train data).

To predict Equation (15) using Machine Learning algorithms, 16 Machine


Learning (Multiple Linear Regression, Ridge, Lasso, ElasticNet, KNN,
AdaBoost, SVM, Decision Tree, Random Forest, XGBoost, GradientBoost,
LightGBoost, CatBoost) and 1 (ANN) Artificial Neural Network (Multi-Layer
Perceptron (MLP) Regressor) algorithm. In this context;

First, the prediction was made with the Multiple Linear Regression
model, R2 = 0.47 for the train data and R2 = 0.38 for the test data. Since
the relatively large difference between these two values ​suggests the risk
of overfitting, a 10-fold cross-validation was performed and it was
observed that R2 decreased to 0.41. In this case, since the difference
between the R2 values ​of the train and test data decreased, it was decided
that there was no overfitting problem in the model. However, since the
success (R2) of the model was low, it was decided that other Machine
Learning algorithms should also be used.

In the second stage; Serial analyses were performed using 13 ML ( Ridge,


Lasso, ElasticNet, KNN, AdaBoost, Decision Tree, Random Tree,
GradientBoost, XGBoost, CatBoost, LightGBoost ) models and 1 ANN
(Multi-Layer Perceptron (MLP) Regressor ) model. Although 99% and
100% success were achieved in these analyses, it was not possible to
obtain the coefficients in the established model that would be used to
calculate the optimum price from these Machine Learning models.

In the third stage; Three of the ML algorithms in the second stage ( XGB,
SVM, and ADA ) were rearranged to produce coefficients, and predictions
were made with these methods. To make these predictions,
booster='gblinear' in XGBoost, kernel='linear' in SVR, and
base_estimator=LinearRegression() hyperparameters in AdaBoost were
used. Hyperparameter optimization (fine-tuning) operations for these 3
methods were carried out with the Grid Search CV method. As a result of
these analyses, it was seen that the algorithm that gave the best results
was AdaBoost.

For this reason, AdaBoost estimation of the Final Model was made using
all data (without separating it as train and test), this model was trained
(fit) with all data, and the obtained result was reported. ( AdaBoost is a
tree-based algorithm that makes predictions on more than one tree. To
obtain the general result of the model (B1, B2 parameters); the
coefficients obtained in each tree were averaged ).

Using the obtained B1 and B2 coefficients, the optimum QP = 0.76 was


found from -B1/2*B2 . However, since the data is initially scaled with the
Stabdart Scaler, it is necessary to reach the real QP value by performing a
reverse scaling process at the last stage. The procedure to be applied to
find the value of an X series before scaling is shown in Equation (16):

x_original = x_scaled × std_dev + mean……………………………….(16)

In the study, df.describe().T code was used to find the standard deviation and
average of the QP value, that is, descriptive statistics were used. By
substituting the standard deviation and mean values ​of QP taken from
descriptive statistics into Equation (16), the real QP value was found to
Open in app
be
Sign up Sign in
6669.16.
Search Write

To find the amount of Q corresponding to this value; The series was


sorted from largest to smallest according to QP, when QP = 6677.54, Q =
59, and when Q*P = 6669.16, the answer to the question of what Q was
sought by using ratio-proportion and Q = 58.92596 was found. Then, by
dividing the resulting number 6669.162 by 58.92596, it was found that the
Final Optimum Price should be 113.178678 Dollars.

IN CONCLUSION
Although price, which is the invisible hand that regulates the markets
according to Adam Smith (Date: 1790, Scotland), is at the center of economic
activities, a simple and clear explanation of how to do price optimization
could not be found in the research. In particular, a significant deficiency has
been identified in how price optimization can be done using Machine
Learning algorithms. With this study, an attempt was made to close the gap
in question to some extent. Researchers who follow this study step by step
can easily develop Machine Learning algorithms that calculate the optimum
price level for their own data sets and obtain the optimum price with a more
realistic (more scientific) method. Hoping it will be useful…

Thanks
OneAMZ Data Scientist Elif Canduz, for her contributions in compiling the data of
this study, Techpro Education Machine Learning instructor Mustafa Erdogan,
who provided the opportunity to discuss/test the accuracy of the established
Machine Learning models, Techpro Education assistant instructor Mert Urper, for
his contributions in the analysis and deployment of the model in Stramlit. I would
like to thank Seher Gumus for her devoted efforts in depositing the work in
Streamlit.

References
Clarkson, A. and Black, A. (2016). Price Optimisation: A Case Study of New
Pricing Techniques.
https://www.actuaries.org.uk/system/files/field/document/G2%20ClarksonBl
ack.pdf

Kulkarni, A. (2022). How to Build A Price Recommender App With Python.


Anaytics Vidhya. https://www.analyticsvidhya.com/blog/2021/08/build-a-
price-recommender-app-with-python/

Ruparelia, S., Pezzuli, S. and Looft, M. (2022). Price Optimisation Issues &
Challenges. The Actuarial Profession.
https://www.actuaries.org.uk/system/files/documents/pdf/a02ruparelia.pdf

Price Optimisation Price Optimization Price Analysis Machine Learning

Econometrics
Written by Ismetgocer Follow

40 Followers · Writer for Academy Team

More from Ismetgocer and Academy Team

Ismetgocer in Academy Team Mustafa Erdogan in Academy Team

Deep Learning’de Pre-Trained / Makine Öğrenmesi Sınıflandırma


Transfer Learning Modeller Nasıl… Modelleri: Accuracy, Precision,…
Makine öğrenimi (Machine Learning) ve derin Makine öğrenme modellerindeki en temel
öğrenme (Deep Learning), birçok endüstriye… hususun modelin performansının…

7 min read · Oct 27, 2023 7 min read · Apr 14, 2023

55 94 1
Dr. Fatih Hattatoglu in Academy Team Ismetgocer in Academy Team

IT Alanında Eğitim Alanlar için Weight Selection in Transfer


«Nokta Atışı» Öneriler Learning Models in Deep Learnin…
Bu yazı ana hedefte IT (Information Transfer Learning models are trained using
Technology — Bilgi Teknolojileri) alanında… millions of images, dozens of convolutional…

12 min read · Jan 4, 2024 6 min read · Dec 19, 2023

14 2

See all from Ismetgocer See all from Academy Team

Recommended from Medium

Hazal Gültekin Ali

Part1: Demand Forecast Modeling Mastering Forecasting: Unveiling


In this article, I will implement an end-to-end the Power of VAR Modeling for…
demand forecasting model using Machine… 1. Introduction to VAR Modeling
10 min read · Mar 12, 2024 10 min read · Jan 14, 2024

87 71

Lists

Predictive Modeling w/ Practical Guides to Machine


Python Learning
20 stories · 1013 saves 10 stories · 1219 saves

Natural Language Processing The New Chatbots: ChatGPT,


1309 stories · 795 saves Bard, and Beyond
12 stories · 342 saves

Rosaria Silipo in Low Code for Data Science Prof. Frenzel

Is Data Science dead? Statistical Measures Every Analyst


In the last six months I have heard this Must Know — Part1
question thousands of time: “Is data science… Measures of Central Tendency, Variability,
Quartiles, Z-Scores, and as always:…

6 min read · Mar 11, 2024 11 min read · Feb 5, 2024

526 9 1K 7
Jakob Runge in Causality in Data Science Tahera Firdose

Hands-on Causal Discovery with Is the Price Right: A Machine


Python Learning Approach to Price…
A Gentle Guide to Causal Inference with Image by breadcrumbs
Machine Learning Pt. 9

14 min read · Mar 4, 2024 · 13 min read · Dec 27, 2023

169 2 126

See more recommendations

You might also like