Handling non-constant variance – log transformation
We’ve learned how to deal with changes in the level of the time series that occur due to either trend or seasonal patterns. In this recipe, we’ll deal with changes in the variance of time series.
Getting ready
We’ve learned in Chapter 1 that some time series are heteroscedastic, which means that the variance changes over time. Non-constant variance is problematic as it makes the learning process more difficult.
Let’s start by splitting the solar radiation time series into training and testing sets:
train, test = train_test_split(time_series, test_size=0.2, shuffle=False)
Again, we leave the last 20% of observations for testing.
How to do it…
We’ll show how to stabilize the variance of a time series using the logarithm transformation and a Box-Cox power transformation.
Log transformation
In Chapter 1, we defined the LogTransformation...