Product demand forecasting with Knime

Reading Time: 5 minutes

In this blog, we are going to see, Importance of demand forecasting and how we can easily create these forecasting workflows with Knime.

Market request forecasting is a basic procedure for any business, however maybe none more so than those in buyer packaged products. Stock, production, storage, delivering, showcasing – each aspect of CPG and retail organizations’ activities are influenced by accurate forecasting. Identifying shoppers’ preferences and their likeness to buy, make these organizations settle on better choices with respect to product offerings, entering new markets and their supply chains, guarantee that stores/stocks are stocked, and limit the danger of stock shortages or overflow.

Overstocks and out-of-stocks

Аn excess or short supply of products can affect your company’s profitability and costs retailers worldwide $1.1 trillion each year. Leftover stock is often marked down and leads to low sales turnover. Out-of-stock situations, on the other hand, make for lost sales and dissatisfied customers who can easily switch to your competitors.

what AI can Bring to Retail??

If we want to see what AI can bring to Retail, we have some strong stats from the UK retailer survey. According to the survey Productivity and personalization will help the AI market reach $15.7 trillion by 2030. Moreover, The global market for AI in retail is currently worth $993.6 million and will grow to $5,034 million by 2022.

Retailers are using AI for Driving sales and anticipate demands, understanding consumer behavior, offer highly-accurate individualized promotions, Targeting consumer segments and Assess Existing competitions. which are giving them great success and result in high revenue.

AI benefits to Retail Business

According to the same survey, the Benefits of Artificial Intelligence for retail businesses worldwide in 2018.

So, we can see AI is helping retailers in saving cost, increased productivity. we can easily forecast the sales and needs of the customer.

Eliminating overstocks and out-of-stocks with AI

One of the business applications of artificial intelligence in retail is restocking. AI helps retailers replenish supplies by identifying demand for a particular product based on

  • sales history
  • location
  • weather
  • promotions
  • trends
  • … and so on.

This way companies can prevent underperforming products from building up, stock what customers are likely to buy, achieve faster deliveries, reduce returns, and save lots of money.

Forecasting workflow with Knime

The workflow we are going to talk about is a Time series guided dashboard analysis with Knime.

You can download the workflow from official knimeHub:

In this workflow we have taken grocery dataset for 10 stores contains data for 50 different items. This workflow can be deployed for a guided analytics web-portal, i.e. easy to use Dashboard for time series inspection and forecasting.

There are multiple step in this workflow:


  • Data preparation: data loading, data exploration, data imputation
  • Selecting parameters and filtering data: selecting a particular store, item, setting parameters for weekly/monthly stats visualizations
  • data visualizations: data inspection, weekly/monthly sales
  • seasonality inspection: seasonality inspection, seasonality removing, lag preparation
  • model training and evaluation: training model on time series data, metrics evaluation, line plot for performance

you can deploy this to knime sever and use this workflow for guided analytic forecasting platform but in the knime analytics platform itself, you can click right on any component and click on an Interactive view, to see the dashboard view.

These are the steps of this whole demand forecasting workflow, let’s see an overview of this workflow’s dashboard, from where you can control all stages according to your use case or need.

Overview of demand forecasting platform

Data Pre-processing

We have taken 4 years of product sales dataset from kaggle which contains historical sales records of 10 stores and 50 products, from the year 2013 through 2017.

This is our loaded dataset, now we have to select the parameters to filter the dataset.

For the purpose of this task , we will only look at the sales of ‘item’ 1 from store 1.

Data Visualisation/ Analysis

If we talk about any time series task or inspection, one of the major thing we can do is to see our sales distribution by yearly, monthly or weekly.

For example, suppose your supply chain manager told you that , there is some problem with this ‘1’ store. Maybe regular cases of overstock and out of stock are coming from this store. So, what can we do, just see different graphs to have proper inspection inside sales data.

First, you can select either you want to see weekly or monthly distribution of your data, also you can select particular time interval.

Now you can see a dashboard consist of different visualisation charts.

Data inspection
Item sales comparison plots

Data Inspection

Now after visualizing the data, we want to perform forecasting tasks on our data but first, we need to inspect some time series components like seasonality, trend. And we have to remove these components to make our data stationary.

Auto-correlation plot

By clicking on next, this workflow will automatically remove the seasonality and train the machine learning model on this data.

Forecasting results and models

model training

In this workflow, we have only trained a normal linear regression model, but you can add many more models like tree regression , stats model like ARIMA.

After that you can see model evaluation matrices and graph to see performance

original vs prediction graph

So this is all about this workflow, here we have only taken a use case of grocery data but you can create much more time series analysis dashboard for different domains/use cases like:

use cases

This is all from this blog. Hope you enjoyed the blog and it helped you!! Stay connected for more future blogs. Thank you!!

Stay Tunes, happy learning 🙂

Follow MachineX Intelligence for more:


Written by 

Shubham Goyal is a Data Scientist at Knoldus Inc. With this, he is an artificial intelligence researcher, interested in doing research on different domain problems and a regular contributor to society through blogs and webinars in machine learning and artificial intelligence. He had also written a few research papers on machine learning. Moreover, a conference speaker and an official author at Towards Data Science.

1 thought on “Product demand forecasting with Knime8 min read

Comments are closed.