09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6

Time Series

To Make the Seasonal Effect Additive

If the series has a trend and the volume of the seasonal effect appears to be

on the rise with the mean, then it may be advisable to modify the data so as

to make the seasonal effect constant from year to year. This seasonal effect

is said to be additive. However, if the volume of the seasonal effect is directly

proportional to the mean, then the seasonal effect is said to be multiplicative,

and a logarithmic transformation is needed to make it additive again.

To Make the Data Distribution Normal

In most probability models, it is assumed that distribution of data is

Gaussian or normal. For example, there can be evidence of skewness in a

trend that causes “spikes” in the time plot that are all in the same direction.

To transform the data in a normal distribution, the most common

transform is to subtract the mean and then divide by the standard

deviation. I gave an example of this transformation in the RNN example in

Chapter 5; I’ll give another in the final example of the current chapter. The

logic behind this transformation is it makes the mean 0 and the standard

deviation 1, which is a characteristic of a normal distribution. Another

popular transformation is to use the logarithm. The major advantage of a

logarithm is it reduces the variation and logarithm of Gaussian distribution

data that is also Gaussian. Transformation may be problem-specific or

domain-specific. For instance, in a time series of an airline’s passenger

load data, the series can be normalized by dividing by the number of days

in the month or by the number of holidays in a month.

Cyclic Variation

In some time series, seasonality is not a constant but a stochastic variable.

That is known as cyclic variation. In this case, the periodicity first has to

be predicted and then has to be removed in the same way as done for

seasonal variation.

127

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!