Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Sequences, Time Series and Prediction/Week 1 - Sequences and Prediction/Week_1_Exercise_Answer.ipynb
Views: 13373
Now that we have the time series, let's split it so we can start forecasting
Naive Forecast
Let's zoom in on the start of the validation period:
You can see that the naive forecast lags 1 step behind the time series.
Now let's compute the mean squared error and the mean absolute error between the forecasts and the predictions in the validation period:
That's our baseline, now let's try a moving average:
That's worse than naive forecast! The moving average does not anticipate trend or seasonality, so let's try to remove them by using differencing. Since the seasonality period is 365 days, we will subtract the value at time t – 365 from the value at time t.
Great, the trend and seasonality seem to be gone, so now we can use the moving average:
Now let's bring back the trend and seasonality by adding the past values from t – 365:
Better than naive forecast, good. However the forecasts look a bit too random, because we're just adding past values, which were noisy. Let's use a moving averaging on past values to remove some of the noise: