How to Detect Retail Sales Trends in Anaplan


Retail Knowledge | Detecting Trend

Using machine learning to detect a sales trend is a science and an art. Obviously no computer program or set of calculations could ever know everything that’s going on with your business. The creative side of detecting a trend is built upon your familiarity with the way your business or customer behaves. While some of these nuances can be reduced to numbers other conditions cannot be predicted easily and will continually require your input. To get you started, I will show you some high level techniques using minimal math that you can use to teach 

Anaplan to detect sales trends.


Good Point You Just Made.pngHOW IT WORKS
At the heart of machine learning is the ability to use historical information to self-correct, or learn from, prior decisions. When you measure the difference between your forecasted sales and your actual sales, you are measuring the forecast error.

Forecasting error is the difference between your forecasted sales and the actual sales.

One rather simple method for sales trend detection is to make the distinction between two forecasting concepts:

  • Magnitude measures the |absolute| value of your forecast errors, which is nothing more than the difference between your forecast and actual. If the average direction calculation is small compared to the magnitude then the trend is very small. Conversely, if the direction calculation is close to the magnitude then the trend is quite large.
  • Direction measures the sign, or how high or how low, your forecasts are from actual. A positive or negative sign will tell you what direction is the trend. If your average signed errors are equally high as they are low, then the direction will equal zero and no trend will be detected.

Combining these two will give your trend calculation both direction and velocity:


Say we have a product that has sales and forecasts for the last eight weeks that looks like this:.


For the first four weeks our forecast algorithm is working great. Then, on week 5, we had a very large forecast error of 29. This is where the art of machine learning comes in. We need to give Anaplan some smarts about how to handle the errors. Since this is only one week, we can tell the program to slightly nudge up our forecast.

On week 6 and 7, we missed it again in the same direction. Now we teach our software to chase the trend a little faster, so that by week 8, we’re very close to forecasting the sales correctly.

Had the errors averaged out to zero over the last four weeks, we teach Anaplan to interpret the errors as noise.

This is how many machine learning algorithms work for detecting trend. In the example, I showed you a very simple model of how we can use week to week sales to auto-correct the next week’s forecast. As you can imagine there are a lot of nuances to deal with and your business knowledge will help you tremendously. Try not to over-fit though. It’s tempting, I admit, but the computing effort will go up exponentially compared to the benefit you will get.

For further reading on this topic I suggest reading the post on variable response smoothing. This article will give you the details and the math needed to fully implement a machine learning program.