Autocorrelation
Autocorrelation is the correlation between two elements of a series separated by a given interval. Intuitively, we would, for example, assume that knowledge about the last time step helps us in forecasting the next step. But how about knowledge from 2 time steps ago or from 100 time steps ago?
Running autocorrelation_plot
will plot the correlation between elements with different lag times and can help us answer these questions. As a matter of fact, pandas comes with a handy autocorrelation plotting tool. To use it, we have to pass a series of data. In our case, we pass the page views of a page, selected at random.
We can do this by running the following code:
from pandas.plotting import autocorrelation_plot autocorrelation_plot(data.iloc[110]) plt.title(' '.join(train.loc[110,['Subject', 'Sub_Page']]))
This will present us with the following diagram:
The plot in the preceding chart shows the correlation of page views for...