-
Book Overview & Buying
-
Table Of Contents
Time Series with PyTorch
By :
Typically, you will deal with regular time series like this, where we have data collected at regular intervals. By contrast, irregular time series are built with data that, while recorded sequentially, varies in the intervals of collection. For example, natural disasters are infrequent and can vary from days apart to years. Regular data can degrade into irregular data if we have a lot of missing data. This is not unusual in retail settings, where we often see low-frequency items/products, such as the sales of Bugatti in the UK (169 in 2019). Let’s look at a practical example to illustrate this:
df = pd.read_csv(Path.cwd().parent / "data" / "bugatti_sales.csv")
print(df.head(n=5))
The output for this code is as follows:
year month sales
0 2016 Mar 1
1 2016 Apr 2
2 2016 Sep 2
3 2016 Nov 1
4 2016 Dec 1
We can see from the table that several months are missing (no data) between particular...