Get startedGet started for free

Seasonality

1. Seasonality

By now, you know how to construct a sound basetable. In this final chapter, you will complete your knowledge with some advanced basetable concepts. First, you will learn how to deal with seasonality.

2. Seasonal effects (1)

As an example, consider the problem where you want to predict whether a candidate donor will donate more than 50 Euros in the next month, using predictive variables like mean donation, number of donations and so on. In this case, both the target and the predictive variables strongly depend on the donations made by a donor.

3. Seasonal effects (2)

However, donations are not equal over time. Indeed, around the holidays, people make more donations than during the rest of the year.

4. Seasonal effects (3)

Moreover, donations are generally higher during the holidays.

5. Seasonality and the timeline (1)

Now assume you want to use the model to predict donations in January 2019. As usual, you need to reconstruct the timeline in history in order to make a sound basetable.

6. Seasonality and the timeline (2)

If you would use a timeline that has May 2018 as target period, there will be less targets, as less donations are made in May than in January. Moreover, also the candidate predictors will have lower values, as people tend to make smaller donations in April compared to December.

7. Seasonality and the timeline (3)

It is clear that constructing a basetable on this timeline is not a good idea: this basetable is not representative for January, and hence the resulting predictive model will perform badly in January.

8. Dealing with seasonality

Seasonality is not always a problem, so it is useful to first check if there is any seasonality in the predictive modeling problem you are dealing with. For instance, in the donations case, you could check whether there are more donations in certain months using the `groupby` function in Python. If there is indeed seasonality, one should be very careful when reconstructing history to construct the basetable. For instance, if there is seasonality and you want to make predictions in January, you should go back in history exactly one or two years, such that the basetable is representative for that period of the year.

9. Seasonality and predictive models

To illustrate the effect of seasonality, let's compare two models, one that uses the timeline given before, where the target is calculated in May 2018, and one model that uses the correct timeline, where the target is calculated in January 2018. In both cases, we evaluate the model on the new data, which is based on the timeline with target period January 2019. When evaluating the predictions using the AUC, it is clear that the model using the correct timeline performs better.

10. Let's practice!

Time for you to discover the effect of seasonality on predictive models!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.