23. December 2020
There are a lot of concerns about hygiene precautions at the upcoming holidays. Nonetheless, we wanted to wish you all a merry Christmas and therefore give you something to smile about. Maybe you (or your children) have wondered whether it’s going to snow on Christmas in Leipzig. One fellow researcher of ScaDS.AI Leipzig built a forecasting model based on open data from the German Weather Service. With this, he hopes to answer your question about a snowy, merry christmas. The model maybe can tell us, if it’s really going to snow on Christmas. But how did he do it? And what do gingerbread and weight loss have in common with each other? And what does this question have to do with this snow height prediction model? To explain all this, let’s first start with a small tutorial on how to build such a prediction model yourself.
Creation of a simple model for the prediction of snow depth in Leipzig based on the day’s weather data.
The German Weather Service offers historical and current data, including daily observations at weather stations. Available data are temperature, pressure, precipitation, sunshine duration, etc. You can find them here.
For Leipzig data to 3 weather stations are offered (Holzhausen, Halle/Leipzig, Mockau). The data goes back to 1863 with gaps, almost continuous measurements for all 3 stations from 1935 onwards are available. From these data, the amount of snow in cm for Leipzig can be compared since 1935:
In the graph, the number of days it snows and the average height of snow has decreased since 1935. Nevertheless, there is hope, because of course in some years snow at least fell on December in Leipzig.
The goal is to train a model with the historical Leipzig data with the aim to predict the snow height. This prediction is based on the respective daily values.
Merging and cleaning the data sets results in a data set of more than 30,000 days with daily values for:
You need to further enrich your data with entries for the respective year, month and calendar week.
We used xgboost – an open source supervised machine learning library using Decision-Tree-based algorithms and gradient boosting to build the predictive model. This xgboost library has the benefit that it can also handle missing values that are still contained in the merged dataset.
Now train the model on the data set with the data from 1935 to 12/2009.Subsequently, we test which prediction is made for the time range from 01/2010 to 12/2020, which is not yet known to the model:
As you can see the first result is not very accurate due to the simple model, because the predictions for snow with it are only possible with the available respective daily values for temp, air pressure etc. for this particular day. In order to develop a more accurate forecast model, it would be necessary to add further regional and supra-regional data, as the weather is not only a local phenomenon. It would be conceivable to upgrade the model to a more comprehensive and thus also more accurate forecast model by integrating previous days into the forecast using a sliding window approach.
Although the model unfortunately doesn’t give much hope for a white Christmas, there is still some chance for a snowball fight or a day in the snow on a sled for the rest of December. Which may not be such a bad idea in terms of the plentiful food we eat during the Christmas and pre-Christmas season. At least if you look at the correlations and intersections of the Google search queries statistics of gingerbread and losing weight in Germany.
Now it’s up to you to decide whether maybe it’s just a coincidence or if there is a definite connection between these search requests. Nevertheless, a more or less healthy diet during the holidays combined with some exercise in the fresh air also helps to keep our immune system active. Thus, a day in the snow also supports us in a broader sense to stay healthy through the pandemic. In keeping with this spirit, we wish you a Merry Christmas, a Happy New Year and to stay healthy and happy.