How it works...
In Steps 2 to 5, we downloaded Google's stock prices from 2010-2018, resampled the values to a monthly frequency, split the data into training (2010-2017) and test (2018) sets, and plotted the series.
In Step 6, we fitted three different SES models using the SimpleExpSmoothing class and its fit method. For fitting, we only used the training data. We could have manually selected the value of the smoothing parameter (smoothing_level), however, the best practice is to let statsmodels optimize it for the best fit. This optimization is done by minimizing the sum of squared residuals (errors). We created the forecasts using the forecast method, which requires the number of periods we want to forecast for (which is equal to the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access