scroll

Geekogram

Our $0.02 on math, science & technology

Optimising Marketing spends for a Retail Startup using Machine Learning on AWS Cloud

July 2023 | 10-minute read

content-image

Tagged: DemandForecasting | InventoryOptimization | AWSMachineLearning | SupplyChainManagement | DataAnalysis | ForecastAccuracy | InventoryPlanning | AmazonForecast | DataTreatment | DemandVariations | SupplyChainEfficiency | InventoryReduction | GanitSolutions | DataInsights | AWSArchitecture

Predicting demand for medical products can be a formidable challenge, since many items such as sutures, surgical mesh, and other essential products have no underlying seasonality patterns, nor a consistent shelf life.

Ganit is an AWS Advanced Tier Services Partner that provides smart solutions at the intersection of hypothesis-based analytics, discovery-driven artificial intelligence (AI), and new-data insights.

Ganit’s client is a leading manufacturer of sutures, surgical mesh, and surgical clips appliers that caters to over 2,500+ hospitals and nursing homes across India. They have a highly customized approach of dispensing approximately 1,000 stock-keeping units (SKUs) across their portfolio from nine separate supply locations across the country.

While about 150 SKUs contribute around 77% of their sales, the client maintains a long tail of slower-selling SKUs that are essential for keeping products’ assortment. Carrying slow-moving SKUs is critical to the business: their distributors will purchase a whole basket of products, and without having the slower-moving SKUs the client would lose the complete sale.

Working together with the client and using Amazon Forecast, an AWS machine-learning (ML) time-series forecasting service, Ganit helped improve their forecasting accuracy by 20% and reduce total inventory by 8%, while also maintaining desired overall fulfilment rates of 95%.

In this post, we will explore how Ganit worked with the client to achieve reductions in inventory by designing a robust solution with Amazon Forecast. We’ll detail the approach used to define the objectives and discover the data treatments, and cover employing the flexible architecture provided by Forecast to turn the client’s data into a strength.

Challenges Faced by the Client

The client’s inventory planning was heavily human-reliant, leading to inconsistent and inaccurate forecasts. A static inventory norm for all SKUs based on approximately 15% of the last three months average sales resulted in high working capital invested in the slow-moving inventory. In addition, inventory planning for 1,000+ SKU stock point combinations added another dimension of complexity and cost to their supply chain management problem.

Under-forecasting for the fast-moving SKUs is an expensive mistake for the business to make. It adversely affects potential revenue generation, as supply falling short of demand is revenue. While preferable to the former, over-forecasting drives increased operational overhead for the business in the form of storage costs.

Demand Forecasting

Ganit’s client had several goals at the start of the engagement:

  • Optimize inventory to lower costs

  • Define safety stock standards.

  • Establish reorder points.

Ganit targeted the following objectives to help meet the client’s goals:

  • Establish a robust and scientific mechanism to forecast demand for each SKU at each stock point.

  • Avoid overstock and stock-out situations, by optimizing inventory to handle variations in demand tailored for the SKU at their stock point.
  • Fine-tuning the current month’s production planning.

  • Near-future production planning.

  • Raw material procurement planning.

A diagram of inputs and outputs to for the three-month forecast can be seen below:

content-image

Figure 1: Usage of three-month forecast

Ganit estimated demand at the SKU level for 1,563 SKU stock point combinations, reflecting 83% of the client’s total product demand. Multiple forecasting techniques were attempted, and Ganit opted to use Amazon Forecast for the following reasons:

  • Improved accuracy and better response to demand variations.

  • Flexibility to control for forecast bias.

  • Ability to model complex relationships found in the data.
  • Capacity to run multiple threads in parallel.
  • Ease in setting up the infrastructure.

Data Sources and Treatment

To build the forecasting model, Ganit used the following inputs:

  • Demand data

  • Item metadata

  • Extraneous features and independent variables impacting demand
content-image

Figure 2: Approach to forecast generation.

The analytical dataset (ADS) was created by applying several extract, transform, and load (ETL) processes on the client’s data. Ganit started with transactional data collected over the past three years. After filtering out unrelated data, Ganit aggregated it to monthly SKU-level stock levels as a starting point for model building.

The first data treatment step was to remove returned orders. The unpredictable nature of order returns and defects in the manufacturing process means Ganit needed to remove them from the dataset, as they are not reflective of actual demand. The team applied similar featurization to remove other noisy signals, including delisted SKUs, bulk return orders, export, and tender orders.

SKU Stock Point Grouping (ABC-XYZ)

Ganit classified the SKU stock points into an ABC-XYZ framework—a combination of sales contribution and ease of prediction. Here, ABC indicates the sales contribution (with A being the highest contributor), and XYZ suggests predictability of the SKU’s demand (with Z being the hardest to predict).

Ganit applied multiple data treatments, eventually yielding the raw data containing SKU stock point combinations with actual demand.

The team further enhanced data quality using item metadata. Ganit applied other data treatment such as missing value and COVID lockdown adjustments to account for demand patterns during the pandemic.

After consulting the operations and business teams and the insights derived from exploratory data analysis (EDA), Ganit performed data treatment. The raw data was treated for outliers using quantile cutoffs and smoothened to generate the required ADS.

Forecasting Process

ADS, alongside the item metadata and regressors, were fed as the inputs to Amazon Forecast. Ganit tried and tested multiple modelling techniques, namely ETS, Arima and its variations, Prophet, CNN-QR, and Deep AR+ (AutoML feature was also used). Amazon Forecast provides ensemble modeling, meaning multiple algorithms are used across various SKU stock point combinations for the best model accuracy.

The Deep AR+ algorithm in Amazon Forecast produced the best acceptable results for the given data and was chosen as the forecast model.

Amazon Forecast uses backtesting to produce accuracy metrics. During backtesting, Forecast automatically splits time-series data into two sets: a training set and a testing set. The training set is used to train a model and generate forecasts for data points within the testing set. Forecast evaluates the model’s accuracy by comparing forecasted values with observed values in the testing set.

During the model design, three forecasts were generated at p40, p50, and p60 quantiles, with p50 being the base quantile which had equal probability of both over and under forecast. The selection of quantiles was based on SKU type, and p60 was chosen for fast-moving SKUs, as the business impact of customer loss was significantly higher than holding extra inventory, and p50 was chosen for slow-moving SKUs.

Once the forecast export was complete, the files were combined to yield the consolidated forecast file. Using the historical estimates, Ganit ran the forecast file through its bias corrector mechanism to adjust for bias and select the right quantile.

After testing the forecast model, a consensus forecast was generated, accounting for the opportunities and risks by taking inputs from the business.

content-image

Figure 3: Overview of the design

Inventory Planning

Selecting the optimal quantity and timing of inventory to align with sales and production capacity was the next logical step to drive additional inventory cost savings.

Production rates are influenced by the forecasted demand and reserve safety stock, among other factors. In contrast, raw material replenishment is governed by the reorder point (ROP), or the level at which orders are placed to ensure minimal disruption in the supply chain.

Ganit calculates safety stock and ROP as follows:

Safety Stock

To alleviate the risk of stockouts, Ganit calculated the safety stock to mitigate potential stockouts caused by uncertainties in supply and demand.

content-image

Where:

Zα = Service level = 95%

E(L) = Median of lead time (L36M) / 30 (number of days)

σL = Standard deviation of lead time (L36M) / 30 (number of days)

E(D) = Forecasted demand

σD = RMSE for forecast

Reorder Point

Reorder Point = Forecasted demand during lead-time + Safety stock

Using the above equations, a dynamically changing safety stock norms and auto-reordering levels were established.

Production System Implementation

A robust technical architecture for the production system was designed and implemented, following AWS Well-Architected best practices, enabling a sustainable, scalable, and cost-effective tool.

content-image

Figure 4: Implemented AWS architecture for demand planner.

The whole process was split into two parts: demand forecasting, and inventory-level calculations

Demand Forecasting Engine

  • Historical monthly demand data was sourced from the client’s PowerBI system, using a manual file maintained by business.

  • Historical demand, regressor data, and metadata information were moved to AWS through DAX Studio accessed via Python scripts.

  • An Amazon Elastic Compute Cloud (Amazon EC2) instance was set up with customized Python scripts to wrangle transaction, regressors, and other metadata.

  • Post-data wrangling, the data was moved to an Amazon Simple Storage Service (Amazon S3) bucket to generate three-month rolling forecasts with Amazon Forecast.

  • The final forecast export output was stored in a separate S3 bucket as well.

Inventory-Level Calculations

  • Other input data for the safety stock and ROP calculation were stored and maintained in S3.

  • Exports of forecasts were then fed back into EC2 for safety stock and ROP calculations.

  • Post calculation, the output was moved to PowerBI and mailed to business users for further downstream activities such as production and distribution planning.

Note that the client wanted to maintain their source and destination systems for input/output data storage due to compliance requirements set by the IT team.

The entire system designed by Ganit was decoupled into multiple key segments. The team set up Apache Airflow scheduler email notifications for each process to notify respective stakeholders upon completion or failure, so that they could take immediate action.

Conclusion:

Post-implementation, Ganit saw consistent and continuous improvement in forecasts, increasing accuracy by ~20% to ~66% over the prior level accuracy of ~46%. This improvement freed up valuable working capital, reduced previous over-forecasting, and led to an 8% inventory reduction by value, without impacting client’s overall fulfilment rates of 95%.

Ganit attributes the success of the mechanism to:

  • Ability to explore: Amazon Forecast provides a flexible, modular platform to experiment with different options and determine the solution best suited to an organization’s needs. Forecast’s backtesting functionality was especially helpful in greatly refining results.
  • Change management approach: A systematic adoption plan helped ensure the output was recorded and consumed in a disciplined manner.

Amazon Forecast’s quick setup, flexibility to use related time series and capture complex relationships, ability to adjust forecasts for controlling bias, better response to demand variations, and capacity to run multiple threads simultaneously made it highly suited to Ganit’s needs.

With a firm foot forward, the client gained the ability to convert data into a strength. This approach provides highly accurate demand forecasts to improve supply chain planning and ensures service levels (fulfillment rate) do not dip below the 95% threshold for any SKU stock point.

To give your supply chain operations an edge using the power of machine learning and data analytics, Ganit recommends you apply Amazon Forecast to your demand planning process. To learn more about Ganit and its solutions, reach out at info@ganitinc.com.



Top