Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Marco Peixeiro

Rating No ratings yet

Build predictive models from time-based patterns in your data. Master statistical models including new deep learning approaches for time series forecasting. Time Series Forecasting in Python teaches you to build powerful predictive models from time-based data. Every model you create is relevant, useful, and easy to implement with Python. You’ll explore interesting real-world datasets like Google’s daily stock price and economic data for the USA, quickly progressing from the basics to developing large-scale models that use deep learning tools like TensorFlow. Time Series Forecasting in Python teaches you to apply time series forecasting and get immediate, meaningful predictions. You’ll learn both traditional statistical and new deep learning models for time series forecasting, all fully illustrated with Python source code. Test your skills with hands-on projects for forecasting air travel, volume of drug prescriptions, and the earnings of Johnson & Johnson. By the time you’re done, you’ll be ready to build accurate and insightful forecasting models with tools from the Python ecosystem.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical, hands-on guide to time series forecasting in Python, covering everything from baseline models and statistical methods (MA, AR, ARIMA, seasonality) to modern deep learning architectures (DNN, LSTM, CNN) and automated tools like Prophet—ideal for data scientists and analysts who want to build and deploy real-world forecasting models. 【Book Arc】 - **Opening (~0%–10%)**: Introduces the core concepts of time series (definition, examples, why forecasting differs from standard regression) and sets up the book’s structure: baselines → statistical models → deep learning → automated libraries. Establishes the production loop (develop, deploy, monitor, collect data, retrain) as a guiding framework. - **Early (~10%–30%)**: Builds simple baseline models (historical mean, naive last value, naive seasonal, drift) using the Johnson & Johnson quarterly EPS dataset. Emphasizes the importance of train/test splits, avoiding look-ahead bias, and introduces MAPE as a key evaluation metric. Explores random walks, stationarity, and differencing with ACF plots. - **Middle (~30%–50%)**: Dives into statistical models: moving average (MA(q)) and autoregressive (AR(p)) processes. Uses widget sales and retail foot traffic datasets to show how to determine model order via ACF/PACF plots, fit models, evaluate with MSE, and reverse differencing to bring forecasts back to original scale. - **Late (~50%–80%)**: Covers complex time series (ARIMA), seasonality (SARIMA), exogenous variables, and multiple time series forecasting. Includes a capstone project on forecasting antidiabetic drug prescriptions in Australia, applying all statistical techniques to a real-world problem. - **Ending (~80%–100%)**: Transitions to deep learning: deep neural networks (single-step, multi-step, multi-output), LSTM architectures (forget/input/output gates), CNNs for filtering noise, and autoregressive LSTM (ARLSTM) for state-of-the-art results. Concludes with a capstone on household electric power consumption and an introduction to automated forecasting libraries like Prophet. 【Key Takeaways】 - **Baselines are non-negotiable** (Early): Simple models like historical mean, naive last value, and seasonal naive provide benchmarks that all complex models must beat. They’re quick to implement and reveal whether added complexity is justified. - **Stationarity is the gateway to statistical modeling** (Early): Random walks and non-stationary series must be differenced (first-order or seasonal) before applying MA/AR models. ACF plots help diagnose non-stationarity—slowly decaying coefficients signal a problem. - **ACF and PACF plots determine model order** (Middle): For MA(q), ACF shows significant coefficients up to lag q; for AR(p), PACF does the same. This diagnostic step is critical—skip it and you’re guessing model complexity blindly. - **Always reverse transformations** (Middle): Forecasting on differenced data is mathematically correct but practically useless. Adding cumulative sums to the last training value restores forecasts to the original scale, making them interpretable for business decisions. - **Deep learning shines with high-dimensional data** (Late): Statistical models struggle with very large time series; DNNs, LSTMs, and CNNs handle complexity better. The book’s key insight is that architecture choice depends on whether you need single-step, multi-step, or multi-output forecasts. - **LSTM gates control memory** (Late): The forget, input, and output gates in an LSTM determine what to remember and what to discard. Understanding these gates is essential for tuning the model to capture long-term dependencies without overfitting to noise. - **Automated libraries like Prophet are industry staples** (Ending): While custom models offer control, Prophet provides a fast, reliable alternative for production forecasting. The book positions it as a complement, not a replacement, for the techniques learned earlier. 【Reading Tips】 - **Skim the first two chapters** if you’re already familiar with time series basics—focus on the baseline implementations and the train/test split logic, which are reused throughout the book. - **Deep-read chapters 4–6** (MA, AR, complex series) carefully: the ACF/PACF interpretation and differencing steps are the hardest conceptual hurdles. Work through the code line-by-line to internalize the workflow. - **Treat the capstones as mini-projects**: The antidiabetic drug prescriptions (statistical) and household power consumption (deep learning) capstones tie everything together. Attempt them without looking at the solutions first to test your understanding. - **Watch for the transformation-reversal pattern**: Every time the book differences data, it later shows how to undo it. Note this pattern early—it recurs in every statistical model chapter and is a common real-world pitfall. - **For deep learning chapters, focus on architecture selection**: The book explains single-step, multi-step, and multi-output variants for DNN, LSTM, and CNN. Understand when to use each rather than memorizing code—the code is repetitive across architectures. 【Coverage Limits】 This guide synthesizes the book’s progression from baselines through statistical models to deep learning and automated libraries, based on excerpts covering roughly the first half of the book. Details on Prophet implementation, ARLSTM specifics, and the final capstone are mentioned but not fully detailed in the source material.
Page 16
vii xiv CONTENTS14.2 Implementing a deep neural network 276 Implementing a deep neural network as a single-step model 278 Implementing a deep neural network...
View in text
Excerpt 2
oblem: we have some historical data, and we wish to build a mathematical expression that will express future values as a function of past values. However, th...
View in text
Excerpt 3
alculate the change in the x-axis, which is the difference between the last index (799) and first index (0). It is deltaX = 800 – 1 equivalent to the number...
View in text
Excerpt 4
wly decaying. This is a behavior that we have not observed before, and it is indicative of an autoregressive process. increases. Therefore, there is no lag a...
View in text
Excerpt 5
ation of a group of data is significantly different from 0. In time series forecasting, we apply the Ljung-Box test on the model’s residuals to test whether...
View in text
Excerpt 6
easonal cycle to help us forecast our time series. Figure 8.2 Marking the month of July of each year. You can see how the month of July has the highest numbe...
View in text
Excerpt 7
c: {ad_fuller_result_2[0]}') be stationary before they are print(f'p-value: {ad_fuller_result_2[1]}') used in the VAR(p) model. For both variables, the ADF t...
View in text
Excerpt 8
rates predictions for more than one target. For example, if we forecast the temperature and wind speed, it is a multi-output model. 244 CHAPTER 12 Introducin...
View in text
Tags
AI categories
ProgrammingDataPython
ISBN: 161729988X
Publish Year: 2022
Language: English
Pages: 458
File Format: PDF
File Size: 22.5 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…