Rossmann operates over 3,000 drug stores in 7 European countries. In their first Kaggle competition, Rossmann Store Sales, this drug store giant challenged Kagglers to forecast 6 weeks of daily sales for 1,115 stores located across Germany. The competition attracted 3,738 data scientists, making it our second most popular competition by participants ever.
Gert Jacobusse, a professional sales forecast consultant, finished in first place using an ensemble of over 20 XGBoost models. Notably, most of the models individually achieve a very competitive (top 3 leaderboard) score. In this blog, Gert shares some of the tricks he’s learned for sales forecasting, as well as wisdom on the why and how of using hold out sets when competing.
Do you have any prior experience or domain knowledge that helped you succeed in this competition?
My hobby and daily job is to work on data analysis problems, and I participate in a lot of Kaggle competitions. With my own company Rogatio I deliver tailored sales forecasts for several companies – product specific as well as overall. Therefore I knew how to approach the problem.
How did you get started competing on Kaggle?
I don’t remember, somehow it has become a part of my life. I enjoy the competitions so much that it is really addictive for me. But in a good way: it is nice exposure for my skills, I learn a lot of new techniques and applications, I get to know other skilled data scientists and if I am lucky I even get paid!
What made you decide to enter this competition?
A sales forecast is a tool that can help almost any company I can think of. Many companies rely on human forecasts that are not of a constant quality. Other companies use a standard tool that is not flexible enough to suit their needs. As an individual researcher I can create a solution that really improves business. And that is exactly what this competition is about. I am very eager to further develop and show my skills – therefore I did not hesitate a moment to enter this competition.
Let’s Get Technical
What preprocessing and supervised learning methods did you use?
The most important preprocessing was the calculation of averages over different time windows. For each day in the sales history, I calculated averages over the last quarter, last half year, last year and last 2 years. Those averages were split out by important features like day of week and promotions. Second, some time indicators were important: not only month and day of year, but also relative indicators like number of days since the summer holidays started. Like most teams, I used extreme gradient boosting (xgboost) as a learning method.
What was your most important insight into the data?
The most important insight was that I could reliably predict performance improvements based on a hold out set within the trainset. Because of this insight, I did not overfit the public test set, so my model worked very well on the public test set as well as the unseen private test set that was four weeks further ahead.
Do you always use hold out sets to validate your model in every competition?
Yes, sometimes using cross-validation (with multiple holdout sets) and sometimes with a single holdout set, like I did in this competition. The advantage of a holdout set is that I can use the public test set as a real test set, not a set that gives me feedback to improve my model. As a consequence, I get reliable feedback about how much I overfitted my own holdout set. Therefore, I do not like competitions where the train/ test split is not-random, while the public/ private split is random: in such competitions, you can build a better model by using feedback from the public leaderboard. I do not like that because I am not aware of any real life problem that would require such an approach. This competition was ideal for me: the train test split was time based, and so was the public/private split!
Do you have any recommendations for selecting data for a hold out set and using it most effectively?
For selecting a hold out set, I always try to imitate the way that the train and test set were split. So, if it is a time split, I split my holdout sample time based; if it is a geographical split by city, I split my holdout set by city; and if it is a random split, then my holdout split will be random as well. You can effectively use a holdout set to push the limit towards how much you can learn from the data without overfitting. Don’t be afraid to overfit your holdout set, the public leaderboard will tell you if you do so.
Were you surprised by any of your findings?
Yes, I was surprised that a model without the most recent month of data (that I used to predict sales further ahead) did almost as well as a model that did include recent data. This finding is very specific for the Rossmann data, and it means that short term changes are less important than they often are in forecasting.
Which tools did you use?
For preprocessing I loaded the data into an SQL database. For creating features and applying models, I used Python.
How did you spend your time on this competition?
I spent 50% on feature engineering, 40% on feature selection plus model ensembling, and less than 10% on model selection and tuning.
What was the run time for both training and prediction of your winning solution?
The winning solution consists of over 20 xgboost models that each need about two hours to train when running three models in parallel on my laptop. So I think it could be done within 24 hours. Most of the models individually achieve a very competitive (top 3 leaderboard) score.
Words of Wisdom
What have you taken away from this competition?
More experience in sales forecasts and a very solid proof of my skills. Plus a nice extra turnover of $15,000 dollars that I had not forecasted.
Do you have any advice for those just getting started in data science?
- make sure that you understand the principles of cross validation, overfitting and leakage
- spend your time on feature engineering instead of model tuning
- visualize your data every now and then
Just for Fun
If you could run a Kaggle competition, what problem would you want to pose to other Kagglers?
You have proven to be very good at creating competitions, I don’t have an idea to improve on that right now But I have the opportunity so let me share one idea for improvement: to create good models and anticipate the kind of error that can be expected, I often miss explicit information on how the train/test and public/private sets are being split. A competition is (even) more fun for me when I don’t have to guess at what types of mechanisms impact model performance.
What is your dream job?
Work for a variety of customers – and help them with data challenges that are central to the success of their business. And have enough spare time to participate in Kaggle competitions!