Nowadays, plenty of statistical, econometrics, and machine learning methods allow CPG companies to predict future events and values. It is important to understand the different algorithmic approaches in order to select the best method to solve the TPM problem and have the best possible predictions.

## Statistical approach

The statistical approach is well known not only in the Data Science environment but also for business people. A linear function is commonly used in econometric models due both to its simplicity and easy interpretation as well as to it being the basis of teaching statistical modeling early on in academics. As the example below illustrates, linear functions are intuitive – we see the linear relationships between the variables:

Machine learning methods applied to the CPG industry solve problems using much more advanced techniques than a linear function. We can divide algorithms into three main groups:

- Supervised learning
- Unsupervised learning
- Semi-supervised learning

Supervised learning is used in situations where we have a variable that we want to explain (e.g., sales) using other variables (e.g., price).

Unsupervised learning is just grouping variables into several clusters. It allows us to find different groups of clients, products, or other things. In this problem, we don’t have a specific variable to explain, like sales. The model works to discover the structure of the data. Unsupervised learning is helpful to get insights from large volumes of new data.

Semi-supervised learning isn’t well-known for now. However, it can be extremely useful in situations where for some cases we know what the sales were but for some, we do not, we have only price, and we want to use both cases to explain sales. It seems impossible, but the most modern approaches are successful, and this may be the future of machine learning methods.

In the case of TPM and TPO, supervised learning is the most common approach, as sales are typically the known factor. In the following examples, we focus on supervised learning.

### Supervised machine learning for sales prediction in the CPG Industry

In the real world, the impact of price and promotions on sales usually have a non-linear relationship.

The question is: What is the exact meaning of “non-linear relationship”? It not only means that the relation is quadratic or logarithmic (i.e., sales = price^{2} +C or sales = log(price) +C) but the relation can be different in particular ranges. For example, for price from 2$ to 4$ the relation can be quadratic, for 4$ to 6$ it can be logarithmic and for price more than 6$ there may be no relation.

It looks difficult to determine but no worries – advanced machine learning algorithms help us to find the best solution. There are plenty of methods. One of the most common is the use of decision trees. Decision trees are algorithms which make sets of decision rules e.g. if price <2$ -> sales = 100, if price>=2$ -> sales=50 etc. One decision tree is often not enough, so it is common to use sets of decision trees which can be described as a forest. Because of the rules in trees the algorithm can find different relations for different ranges of variables. It gives us incredible power in sales predictions and makes future forecasts extremely accurate. You can see the difference in the plot below.

To sum up, machine learning methods allow us to find many kinds of relationships between variables and sales, so it is much more accurate than simple linear regression. The examples above are simpler than reality because sales and price relation can be much more difficult and needs more variables to explain sales, but examples show that machine learning approach makes not only sales predictions more accurate but also makes all the budgeting more precise, stable, and easy to obtain. These are the main reasons for using this modern approach in CPGvision.

###

### About the writer

Patryk Krysiński is Data Science Practice Lead for CPGvision and leads the data science team for TPM, TPO, and RGM. Patryk works to ensure clients can rely on data predictions to improve forecast accuracy and optimize trade spend and pricing decisions. Patryk studied Financial Mathematics at the Gdansk University of Technology and Advanced Analytics - Big Data at the Warsaw School of Economics and has been working in the data science field for six years.