Introduction to Time Series Forecasting With Python
Discover How to Prepare Data and Develop Models to Predict the Future
Time series forecasting is different from other machine learning problems.
The key difference is the fixed sequence of observations and the constraints and additional structure this provides.
In this mega Ebook written in the friendly Machine Learning Mastery style that you’re used to, finally cut through the math and specialized methods for time series forecasting.
Using clear explanations, standard Python libraries and step-by-step tutorials you will discover how to load and prepare data, evaluate model skill, and implement forecasting models for time series data.
Technical Details About the Book
- PDF format Ebook.
- 8 parts, 34 chapters, 367 pages.
- 28 step-by-step tutorial lessons.
- 3 end-to-end projects.
- 181 Python (.py) files.
Clear and Complete Examples.
No Math. Nothing Hidden.
Click to jump straight to the packages.
Time Series Problems are Important
Time series forecasting is an important area of machine learning that is often neglected.
It is important because there are so many prediction problems that involve a time component. These problems are neglected because it is this time component that makes time series problems more difficult to handle.
You can’t just fire a machine learning algorithm at a time series dataset.
- Time series data must be transformed into a supervised learning problem.
- Time series data has temporal structure like trends and seasonality that must be handled.
- Time series data has a forecast horizon.
There are a few conceptual steps you must make before you can start developing forecasting models.
There are also specialized terminology and algorithms to consider and use when working with time series data.
It can feel overwhelming for a beginner and standard machine learning libraries like scikit-learn do not make it easy to get started.
Introducing: “Time Series Forecasting With Python“
This is the book I wish I had when I was getting started with univariate time series forecasting.
It is designed for the practical and hands-on way you prefer to learn.
The goal of this book is to:
Show you how to get results on univariate time series forecasting problems using the Python ecosystem.
It is a cookbook designed for immediate use.
This book was developed using five principles.
- Application: The focus is on the application of forecasting rather than the theory.
- Lessons: The book is broken down into short lessons, each focused on a specific topic.
- Value: Lessons focus on the most used and most useful aspects of a forecasting project.
- Results: Each lesson provides a path to a usable and reproducible result.
- Speed: Each lesson is designed to provide the shortest path to a result.
These principles shape the structure and organization of the book.
What You Will Know and Be Able to Do (Reading Outcomes)
If you choose to work through all of the lessons and projects of this book, you can set some reasonable expectations on your new found capabilities.
- Time Series Foundations: You will be able to identify time series forecasting problems as distinct from other predictive modeling problems and how time series can be framed as supervised learning.
- Transform Data For Modeling: You will be able to transform, rescale, smooth and engineer features from time series data in order to best expose the underlying inherent properties of the problem (the signal) to learning algorithms for forecasting.
- Harness Temporal Structure: You will be able to analyze time series data and understand the temporal structure inherent in it such as trends and seasonality and how these structures may be addressed, removed and harnessed when forecasting.
- Evaluate Models: You will be able to devise a model test harness for a univariate forecasting problem and estimate the baseline skill and expected model performance on unseen data with various performance measures.
- Apply Classical Methods: You will be able to select, apply and interpret the results from classical linear methods such as Autoregression, Moving Average and ARIMA models on univariate time series forecasting problems.
You will be a capable predictive modeler for univariate time series forecasting problems using the Python ecosystem.
‘Time Series Forecasting With Python‘ is for Python Developers…
This book makes some assumptions about you.
- You’re a Developer: This is a book for developers. You are a developer of some sort. You know how to read and write code. You know how to develop and debug a program.
- You know Python: This is a book for Python people. You know the Python program- ming language, or you’re a skilled enough developer that you can pick it up as you go along.
- You know some Machine Learning: This is a book for novice machine learning practitioners. You know some basic practical machine learning, or you can figure it out quickly.
No mathematical prerequisites are needed.
No scikit-learn prerequisites are needed.
This is a playbook, a cookbook, a field guide, not a textbook for academics.
Time Series Forecasting for Beginners
It is an introductory book for time series forecasting.
As such, it focuses on univariate (one variable) data, rather than more complex multivariate problems. It also focuses on using powerful linear methods like ARIMA, rather than more exotic methods.
Everything You Need to Know to Develop Time Series Forecasting Models
You Will Get:
28 Lessons on Python Best Practices for Time Series Forecasting and
3 Project Tutorials that Tie it All Together
This Ebook was written around two themes designed to get you started and using Python for applied time series forecasting effectively and quickly.
These two parts are Lessons and Projects:
- Lessons: Learn how the sub-tasks of time series forecasting projects map onto Python and the best practice way of working through each task.
- Projects: Tie together all of the knowledge from the lessons by working through case study predictive modeling problems.
Here is an overview of the 28 step-by-step lessons you will complete:
Each lesson was designed to be completed in about 30 minutes by the average developer.
Part I. Fundamentals
- Python Environment
- What is Time Series Forecasting?
- Time Series as Supervised Learning
Part II. Data Preparation
- Load and Explore Time Series Data
- Data Visualization
- Resampling and Interpolation
- Power Transforms
- Moving Average Smoothing
Part III. Temporal Structure
- A Gentle Introduction to White Noise
- A Gentle Introduction to the Random Walk
- Decompose Time Series Data
- Use and Remove Trends
- Use and Remove Seasonality
- Stationarity in Time Series Data
Part IV. Evaluate Models
- Backtest Forecast Models
- Forecasting Performance Measures
- Persistence Model for Forecasting
- Visualize Residual Forecast Errors
- Reframe Time Series Forecasting Problems
Part V. Forecast Models
- A Gentle Introduction to the Box-Jenkins Method
- Autoregression Models for Forecasting
- Moving Average Models for Forecasting
- ARIMA Model for Forecasting
- Autocorrelation and Partial Autocorrelation
- Grid Search ARIMA Model Hyperparameters
- Save Models and Make Predictions
- Forecast Confidence Intervals
Here is an overview of the 3 end-to-end projects you will complete:
- Project 1: Monthly Armed Robberies in Boston.
- Project 2: Annual Water Usage in Baltimore.
- Project 3: Monthly Sales of French Champagne.
Each project was designed to be completed in about 60 minutes by the average developer.
Take a Sneak Peek Inside The Ebook
Click image to Enlarge.
BONUS: Time Series Forecasting Code Recipes
…you also get 181 fully working time series forecasting scripts
Sample Code Recipes
Each recipe presented in the book is standalone, meaning that you can copy and paste it into your project and use it immediately.
- You get one Python script (.py) for each example provided in the book.
- You get the datasets used throughout the book.
Your Time Series Code Recipe Library covers the following topics:
- Loading data from CSV files.
- Feature engineering.
- Power transforms like log and sqrt.
- Upsampling and downsampling data.
- Interpolating missing values.
- Moving average smoothing
- Stationarity statistical tests.
- Walk-forward model validation.
- Performance measures like RMSE.
- Naive forecast model.
- Data visualization like line plots and ACF.
- AR forecast models.
- MA forecast models
- ARIMA forecast models.
- Grid search model parameters
- Save forecast models to file.
- Calculate confidence intervals.
This means that you can follow along and compare your answers to a known working implementation of each example in the provided Python files.
This helps a lot to speed up your progress when working through the details of a specific task.
Python Technical Details
This section provides some technical details about the book.
- Python Version: You can use Python 2 or 3.
- SciPy: You will use NumPy, Pandas and scikit-learn.
- Statsmodels: You can use Statsmodels 0.6 or 0.8.
- Operating System: You can use Windows, Linux or Mac OS X.
- Editor: You can use a text editor and run example from the command line.
About The Author
Hi, I'm Jason Brownlee.
I live in Australia with my wife and son and love to write and code.
I have a computer science background as well as a Masters and Ph.D. degree in Artificial Intelligence.
I’ve written books on algorithms, won and ranked in the top 10% in machine learning competitions, consulted for startups and spent a long time working on systems for forecasting tropical cyclones. (yes I have written tons of code that runs operationally)
I get a lot of satisfaction helping developers get started and get really good at machine learning.
I teach an unconventional top-down and results-first approach to machine learning where we start by working through tutorials and problems, then later wade into theory as we need it.
I'm here to help if you ever have any questions. I want you to be awesome at machine learning.
Download Your Sample Chapter
Do you want to take a closer look at the book? Download a free sample chapter PDF.
Enter your email address and your sample chapter will be sent to your inbox.
Check Out What Customers Are Saying:
You're Not Alone in Choosing Machine Learning Mastery
Trusted by Over 10,000 Practitioners
...including employees from companies like:
...students and faculty from universities like:
and many thousands more...
Absolutely No Risk with...
100% Money Back Guarantee
Plus, as you should expect of any great product on the market, every Machine Learning Mastery Ebook
comes with the surest sign of confidence: my gold-standard 100% money-back guarantee.
100% Money-Back Guarantee
If you're not happy with your purchase of any of the Machine Learning Mastery Ebooks,
just email me within 90 days of buying, and I'll give you your money back ASAP.
No waiting. No questions asked. No risk.
Start Forecasting With Time Series Today!
Choose Your Package:
You will get:
- Time Series Forecasting With Python
(including bonus source code)
(a great deal!)
All prices are in US Dollars (USD).
(1) Click the button. (2) Enter your details. (3) Download immediately.
Secure Payment Processing With SSL Encryption
Are you a Student, Teacher or Retiree?
Do you have any Questions?
What Are Skills in Machine Learning Worth?
Your boss asks you:
Hey, can you build a predictive model for this?
Imagine you had the skills and confidence to say:
...and follow through.
I have been there. It feels great!
How much is that worth to you?
The industry is demanding skills in machine learning.
The market wants people that can deliver results, not write academic papers.
Business knows what these skills are worth and are paying sky-high starting salaries.
A Data Scientists Salary Begins at:
$100,000 to $150,000.
A Machine Learning Engineers Salary is Even Higher.
What Are Your Alternatives?
You made it this far.
You're ready to take action.
But, what are your alternatives? What options are there?
(1) A Theoretical Textbook for $100+
...it's boring, math-heavy and you'll probably never finish it.
(2) An On-site Boot Camp for $10,000+
...it's full of young kids, you must travel and it can take months.
(3) A Higher Degree for $100,000+
...it's expensive, takes years, and you'll be an academic.
For the Hands-On Skills You Get...
And the Speed of Results You See...
And the Low Price You Pay...
Machine Learning Mastery Ebooks are
And they work. That's why I offer the money-back guarantee.
You're A Professional
The field moves quickly,
...how long can you wait?
You think you have all the time in the world, but...
- New methods are devised and algorithms change.
- New books get released and prices increase.
- New graduates come along and jobs get filled.
Right Now is the Best Time to make your start.
Bottom-up is Slow and Frustrating,
...don't you want a faster way?
Can you really go on another day, week or month...
- Scraping ideas and code from incomplete posts.
- Skimming theory and insight from short videos.
- Parsing Greek letters from academic textbooks.
Targeted Training is your Shortest Path to a result.
Professionals Use Training To Stay On Top Of Their Field
Get The Training You Need!
You don't want to fall behind or miss the opportunity.
Frequently Asked Questions
Why doesn't my payment work?
I am sorry to hear that you're having difficulty.
- Perhaps you can double check that your details are correct, just in case of a typo?
- Perhaps you could try a different payment method, such as PayPal or Credit Card?
- Perhaps you could try my alternative secure payment processor, click here?
- Perhaps you're able to talk to your bank, just in case they blocked the transaction?
If you're still having difficulty, please contact me and I can help investigate further.
Can I get your books for free?
Sorry, I don’t give away free copies of my books.
You can access all of my best free material on my blog.
Can I get a hard copy of your book?
Sorry, I don't have hard copies by design.
The books are written for immediate use, rather than references to sit on the shelf.
My students like to have the PDF open on their screen next to their editor so they can copy-paste code.
Also, the books are updated often to reflect changes to APIs. The field is moving very fast.
I hope that helps explain the rationale.
Are there Kindle or ePub versions of the books?
Sorry, just PDF Ebooks.
This is by design and I put a lot of thought into it. My rationale is as follows:
- I use LaTeX to layout the text and code to give a professional look and I am afraid that EBook readers would mess this up.
- The increase in supported formats would create a maintenance headache that would take a large amount of time away from updating the books and working on new books.
- Most critically, reading on an e-reader or iPad is antithetical to the book-open-next-to-code-editor approach the PDF format was chosen to support.
My materials are playbooks intended to be open on the computer, next to a text editor and a command line. They are not reference texts to be read away from the computer.
Will I get free updates to the books?
All updates are free.
Books are usually updated once every month or two to fix bugs, typos and keep abreast of API changes.
Contact me anytime and check if there have been updates. Let me know what version of the book you have (version is listed on the copyright page).
How do I get access to any bonuses?
After you complete your purchase you will receive an email with a link to download your bundle.
The download will include the book or books and any bonus material.
Is there any digital rights management (DRM)?
Can I print the PDF for my personal use?
In what order should I read your books?
My best advice is to pick a topic that most interests you and start there.
Can I get a customized bundle of books?
Sorry, I cannot create custom bundles of books for you, it would create a maintenance nightmare for me. I’m sure you can understand.
You can see the full catalog of my books and bundles here.
Can I get an evaluation copy of your books?
Sorry, I no longer distribute evaluation copies of my books due to some past abuse of the privilege.
If you are a teacher or lecturer, I’m happy to offer you a student discount.
Contact me and ask for the discount.
Can I get an invoice for my purchase?
Email me with the details of your order (order number or email address used to make the purchase) and details you would like to appear on the invoice (your name, company name and address).
I will create a PDF invoice for you and email it back.
How long do books take to ship?
There are no physical books, therefore no shipping is required.
All books are EBooks that you can download immediately after you complete your purchase.
Do you ship to my country?
There are no physical books, therefore no shipping is required.
All books are EBooks that you can download immediately after you complete your purchase.
I support purchases from any country via PayPal or Credit Card.
Can I have a discount?
I do offer a discount to students, teachers, and retirees.
Note: I only offer discounts on individual books, not on the bundles. This is because the bundles are already heavily discounted.
If you are a student, teacher or a retiree please contact me and ask for the discount.
Do you have any sales, deals, or coupons?
I generally don't do sales.
If I do have a special, such as around the launch of a new book, I only offer it to past customers and subscribers on my email list.
I do offer book bundles that offer a discount for a collection of related books.
Can I get a refund?
I am sorry to hear that you want a refund.
Please contact me directly with your purchase details (order number or email address used to make the purchase) and I will organize a refund.
Will you help me if I have questions?
Please contact me anytime with questions about machine learning or the books.
One question at a time please.
Also, each book has a final chapter on getting more help and further reading and points to resources that you can use to get more help.
Do I need to be a good programmer?
Not at all.
My material requires that you have a programmers mindset of thinking in procedures and learning by doing.
You do not need to be an excellent programmer to read and learn about machine learning algorithms.
How much math do I need to know?
No background in statistics, probability or linear algebra is required.
I teach using a top-down and results-first approach to machine learning. You will learn by doing, not learn by theory.
There are no derivations.
Any questions presented are explained in full and are only provided to make the explanation clearer, not more confusing.
How much machine learning do I need to know?
Only a little.
If you are a reader of my blog posts, then you know enough to get started.
I do my best to lead you through what you need to know, step-by-step.
How long will the book take me to complete?
I recommend reading one chapter per day.
Some students finish the book in a weekend.
Most students finish the book in a few weeks by working through it during nights and weekends.
How are your books different to other books?
My books are playbooks. Not textbooks.
They have no deep explanations of theory, just working examples that are laser-focused on the information that you need to know to bring machine learning to your project.
My books are not for everyone, they are carefully designed for practitioners that need to get results, fast.
How are your books different from the blog?
The books are a concentrated and more convenient version of what I put on the blog.
I design my books to be a combination of lessons and projects to teach you how to use a specific machine learning tool or library and then apply it to real predictive modeling problems.
The books get updated with bug fixes, updates for API changes and the addition of new chapters, and these updates are totally free.
I do put some of the book chapters on the blog as examples, but they are not tied to the surrounding chapters or the narrative that a book offers and do not offer the standalone code files.
With each book, you also get all of the source code files used in the book that you can use as recipes to jump-start your own predictive modeling problems.
How are the 2 algorithms books different?
The book “Master Machine Learning Algorithms” is for programmers and non-programmers alike that learn through worked examples. It teaches you how 10 top machine learning algorithms work, with worked examples in arithmetic, not code (and spreadsheets) that show how each model learns and makes predictions.
The book “Machine Learning Algorithms From Scratch” is for programmers that learn by writing code to understand. It provides step-by-step tutorials on how to implement top algorithms as well as how to load data, evaluate models and more. It has less on how the algorithms work, instead focusing exclusively on how to implement each in code.
The two books can support each other.
Is there a team or company-wide license?
Due to abuse of the privilege, I only support purchases by individuals.
Is there a license for libraries?
Sorry, I only support purchases by individuals.
Do you have videos?
I only have tutorial lessons and projects in text format.
This is by design. I used to have video content and I found the completion rate much lower.
I want you to put the material into practice. I have found that text-based tutorials are the best way of achieving this.
After reading and working through the tutorials you are far more likely to apply what you have learned.
What operating systems are supported?
Linux, Mac OS X and Windows.
Can you be my mentor or coach?
Thanks for asking. I would love to help, but I just don't have the capacity.
I try to help as many people as possible through my blog and books.
Can I purchase from Amazon (or elsewhere)?
My books can only be purchased from my website.
The reason is that I am a small business and I want a direct relationship with you, my customer, so that I can offer personal support and send out updates about your book and new stuff I am working on.
I hope you can understand my rationale.
What if my download link expires?
It is possible that your link to download your purchase will expire after a few days.
This is a security precaution.
Please contact me and I will resend you purchase receipt with an updated download link.
Can I use your code in my own project?
But, understand that all code was developed and provided for educational purposes only and that I take no responsibility for it, what it might do or how you might use it.
Do you have another question?