Predictive Models for Retail Pharmacies: Forecasting Sales Based on Weather Patterns at Apoteket
Information
Författare: Isak Lindström, Felix MaathzBeräknat färdigt: 2025-06
Handledare: Henrik Tingwall
Handledares företag/institution: Apoteket
Ämnesgranskare: Lars Oestreicher
Övrigt: -
Presentationer
Presentation av Isak LindströmPresentationstid: 2025-06-02 11:15
Presentation av Felix Maathz
Presentationstid: 2025-06-02 12:15
Opponenter: Samuel Ram, Simon Olofsson
Abstract
Retail sales in pharmacies are influenced by external factors, including weather conditions. This thesis investigates the use of machine learning models to forecast sales at Apoteket AB based on historical weather and transaction data. Using data from 2013 to 2023, several supervised ma- chine learning models were developed and evaluated. The model training was conducted using an implementation of gradient-boosted decision trees (XGBoost) and tested with three different configurations: a general model trained on the entire dataset, county-specific models trained on data from individual counties, and category-specific models trained on data for individual product categories. Furthermore, the impact of using a trailing moving average as a model feature was investigated. The models were evaluated using metrics such as Mean Absolute Error (MAE), Mean Squared Error (MSE), and R2. The results show that models incorporating moving av- erage features significantly outperform baseline models, with the general model achieving the highest accuracy with an MAE of 132, representing a 54% improvement over the baseline model. While weather factors do affect the sales of certain product categories, seasonal features such as Weekday, Week, and Month are generally more consistent and reliable predictors of sales trends. The findings demonstrate that machine learning models can effectively predict sales patterns, offering valuable support in strategic planning in retail pharmacies.