Enhancing Demand Forecasting in Pharmaceuticals with AI/ML: A Transfer Learning Approach with Deep Learning
In the pharmaceutical industry, accurate demand forecasting stands as a cornerstone for optimal sales planning. While traditional statistical methods such as ARIMA and Exponential Smoothing have their merits in the field of time series forecasting, deep learning methods are rapidly gaining adoption for the ability to uncover intricate trends and inter-series relationships. However, deep learning presents two significant challenges:
1) the substantial computational resources and time required for model training, and 2) the necessity for extensive training datasets.
In response, our solution integrates the concept of transfer learning. Transfer learning, in the context of time series forecasting, is the practice of utilizing models pre-trained on vast datasets and adapting them to user-specific data. This approach eliminates the substantial wait times and the computational barrier users would otherwise face from ground-up model training.
More important than the notable improvements in efficiency, our transfer learning models outperform Naïve Seasonal by 15% in terms of reduction in Root Mean Squared Error (RMSE). Such accurate forecasts enable pharmaceutical companies to maintain low inventory levels, reducing the risk of product expiration and associated costs. Moreover, transfer learning models can provide reasonable forecasts even when the target data is limited, empowering companies to make informed predictions for newly launched products with minimal historical data.
The selection of datasets is crucial to deep learning models, especially in a transfer learning context. Since the models will not have access to the specific user datasets and thus capture the specific patterns during their primary training phase, the training and target datasets need to be highly relevant. The pharmaceutical industry presents an additional challenge due to its strict data privacy regulations, which limit the availability of comprehensive datasets publicly available.
In response to these limitations, we leveraged the M4 dataset, one of the largest publicly available time series datasets encompassing macro, micro, industry, and finance time series data, as a foundational training resource. Although not tailored to pharmaceutical sales, the M4 dataset’s broad spectrum of patterns may offer a good starting point for transfer learning by allowing the models to learn a wide range of trends.
We curated the M4 dataset with the start date for each data point, realigned the entire dataset chronologically, and selected a continuous segment comprising the most recent 15 years of data, spanning from 2000 to 2015. This approach ensures that the models are attuned to more contemporary signals and trends while minimizing the potential noise from outdated historical data.
In developing and validating our forecasting models, we have leveraged NeuralForecast, a Python library by Nixtla. We conducted pre-training with a variety of models, including both Recurrent Neural Network (RNN) and Multi-layer Perceptron (MLP)-based model architectures, aiming to obtain comprehensive predictive capabilities.
Upon obtaining user-specific datasets, we implement a retrospective validation process for model selection. A portion of the latest historical data is held out from the pre-trained models. Each model will then forecast over the hold-out period, and the best model will be selected by comparing these forecasts against the hold-out set to identify which model most accurately captured the real-world dynamics reflected in actual historical data. The selected model is then utilized for forward-looking predictions into the future.
To assess our transfer learning approach, we conducted tests using 85 anonymized pharmaceutical products’ monthly sales data. We compared the performance of our pre-trained models with several baseline methods, including Naive, Seasonal Naïve, and a non-deep learning expert system that combines regression models with Exponential Smoothing techniques.
Table 1: Performance results of the M4-trained deep learning model and other benchmark models. Metrics are ratios relative to those of the Seasonal Naïve model, lower scores are better.
RMSE | MAE | MAPE | sMAPE | |
---|---|---|---|---|
Transfer Deep Learning | 0.85 | 0.94 | 1.01 | 0.98 |
Expert System | 0.89 | 1.13 | 1.74 | 1.08 |
Seasonal Naïve | 1.00 | 1.00 | 1.00 | 1.00 |
Naïve | 1.24 | 1.24 | 2.90 | 1.10 |
Transfer learning models outperformed the seasonal naïve model, achieving a notable 15% reduction in RMSE. It also outperformed the expert system, which lacked access to the external information from the M4 dataset. A further key advantage observed was computational efficiency; in our experiment, forecasting outcomes for 85 pharmaceutical products, with an average historical span of 41 monthly observations (equivalent to 3.4 years), are completed in approximately 3 seconds1
Looking forward, to further enhance the efficacy of transfer learning models, we can employ several techniques to maximize their predictive capabilities.
First, this abstract only presents outcomes from models that have not undergone fine-tuning with the target dataset, meaning that they have not directly learned from the data they are forecasting. A standard practice in transfer learning involves pre-training on a general meta-dataset and subsequently fine-tuning the models with user-provided data to tailor the learning to the task at hand. Second, while our current approach benefits from training on a diverse dataset that captures a broad spectrum of variables, it may inadvertently incorporate noise irrelevant to the pharmaceutical sector. Access to a substantial, industry-specific dataset, either from public sources or industry members, would allow transfer learning models to provide precise forecasts tailored to the pharmaceutical industry’s unique dynamics.
-
Test machine specifications: 11th Gen Intel® Core™ i9-11900K @ 3.50GHz x 16. ↩
Enjoy Reading This Article?
Here are some more articles you might like to read next: