Walk Forward Validation

Walk Forward Validation

Walk Forward Validation

In time series modelling, the predictions over time become less and less accurate and hence it is a more realistic approach to re-train the model with actual data as it gets available for further predictions. Since training of statistical models are not time consuming, walk-forward validation is the most preferred solution to get most accurate results.
Let us apply one step walk forward validation on our data and compare it with the results we got earlier.
In [333]:

preds = []
info = training.values
for t In testing.values:
model_ES = (ExponentialSmoothing(data).fit())
y_val = model_ES.predict()
preds.append(y[0])
info = numpy.append(info, t)

In [335]:

testing_ = pandas.DataFrame(testing)
testing_['predictionswf'] = preds

In [341]:

plt.plot(testing_['T'])
plt.plot(testing_.predictionswf, '--')
plt.show()

In [340]:

E = sqrt(metrics.mean_squared_error(testing.values,preds))
print ('Test RMSE for Triple Exponential Smoothing with Walk-Forward Validation: ', E)
Test RMSE for Triple Exponential Smoothing with Walk-Forward Validation:  11.787532205759442

We can see that our model performs significantly better now. In fact, the trend is followed so closely that on the plot predictions are overlapping with the actual values. You can try applying walk-forward validation on ARIMA models too.

Exponential Smoothing (Prev Lesson)
(Next Lesson) Time Series – Prophet Model