Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Time Series with PyTorch
  • Table Of Contents Toc
Time Series with PyTorch

Time Series with PyTorch

By : Graeme Davidson, Lei Ma
close
close
Time Series with PyTorch

Time Series with PyTorch

By: Graeme Davidson, Lei Ma

Overview of this book

Neural networks are powerful tools for time-series forecasting, but applying them effectively requires both practical experience and a clear understanding of architectures, training strategies, and evaluation methods. This book brings these ideas together in a structured and practical way. Starting with PyTorch fundamentals, you will build neural networks from scratch and progress through recurrent networks, attention mechanisms, and transformers before exploring forecasting architectures such as N-BEATS, N-HiTS, and the Temporal Fusion Transformer. Along the way, you will learn robust hyperparameter tuning, conformal prediction for uncertainty estimation, and reliable evaluation practices. Unlike most forecasting books, this text also explores topics often overlooked or treated separately, including transfer learning across collections of series, synthetic data generation with diffusion models, and self-supervised representation learning. Beyond forecasting, later chapters cover classification, clustering, anomaly detection, and embeddings for large-scale time-series modeling. Throughout, the focus is pragmatic: theory is reinforced through experimentation and implementation so you can apply these methods confidently to real-world time-series problems.
Table of Contents (22 chapters)
close
close
20
Other Books You May Enjoy
21
Index

Time Series for Everyone

“It’s difficult to make predictions, especially about the future.”

Chances are you have heard this line before (attributed to Niels Bohr or Yogi Berra, depending on whom you trust). Attempting to predict the future has been a human activity for a very long time. Numerous cultures around the world, across time, have attempted to foretell the future based on the distribution of sacrificial animal entrails. In the Bible, the Book of Daniel discusses magicians, enchanters, astrologers, and diviners employed at the court. The Oracle of Delphi provided her predictions while intoxicated by vapors.

The fortunes of forecasters varied throughout history (Emperor Constantine banned soothsayers, mathematicians, and forecasters), but in our day and age, forecasting is a crucial activity. Forecasts and estimations are not always accurate, however; here are some of the most famous examples of people really missing the mark:

  • In 1962, Decca Records executives rejected the Beatles: “We don’t like their sound, and guitar music is on the way out.”
  • In 1977, DEC founder Ken Olson announced: “There is no reason anyone would want a computer in their home.”
  • In 1996, J.K. Rowling got a rejection letter for her first Harry Potter novel: “Children just aren’t interested in witches and wizards anymore.”
  • In 1998, Paul Krugman announced: “The growth of the Internet will slow drastically, as the flaw in ‘Metcalfe’s law’ becomes apparent: most people have nothing to say to each other! By 2005, it will become clear that the Internet’s impact on the economy has been no greater than the fax machines.”
  • In 2007, Steve Ballmer (CEO of Microsoft) had this to say about the iPhone: “[Apple’s iPhone] is the most expensive phone in the world, and it doesn’t appeal to business customers because it doesn’t have a keyboard, which makes it not a very good email machine.”

This list has not been provided to call out the authors of those failed predictions but to stress an important point: it is quite easy to be very certain and very wrong—and there is quite a lot at stake. “How much?” you may ask. Eric Wilson from the Institute of Business Forecasting demonstrated in a study that a 15% forecast accuracy improvement will deliver a 3% or higher improvement in pre-tax profit. For a company with $10 billion turnover, a 1% forecasting accuracy improvement is worth $300 million. Estimating the impact across Fortune 500 companies is left as an exercise to the reader.

With good forecasting models, we can make predictions that improve our world! Apart from business benefits, forecasting results can also help companies and institutes optimize their resources and reduce waste. Forecasting is also integrated into our daily lives; for example, weather forecasting helps us plan our trips and daily lives.

Initially, we’ll focus the chapters of this book on developing an appreciation of time-series data and forecasting predictions using this data. As you progress through the chapters, our simple goals are for you to understand how we forecast using neural architectures such as feedforward neural networks (FFNs), recurrent neural networks (RNNs), and NBEATSx and how these models may be built in PyTorch, along with how to evaluate and target your modeling. Of course, we cannot build every model and pipeline in a way that will work for every use case, but by the end of the book, we hope you understand enough about neural networks, PyTorch, and time-series modeling to experiment on your own.

In this chapter, we’ll take you through a brief history of time-series forecasting, which can be roughly divided into three periods: early origins, classical, and modern. You might wonder why we’re looking at this history—isn’t it just old news? Not at all; as you’ll discover, many older modeling approaches have stood the test of time, being shaped by many fields of study. As we trace the evolution from early astronomical predictions to today’s machine learning (ML) techniques, you’ll gain a richer appreciation of the foundations underpinning the methods we use. More specifically, we will cover the following topics:

  • Why time series?
  • The early period
  • The classical era
  • The promise of deep learning

Your purchase includes a free PDF copy + exclusive extras

Your purchase includes a DRM-free PDF copy of this book, 7-day trial to the Packt+ library (no credit card required), and additional exclusive extras. See the Free benefits with your book section in the Preface to unlock them instantly and maximize your learning.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Time Series with PyTorch
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon