20.03.2021 Views

Deep-Learning-with-PyTorch

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Working with time series

87

network from scratch. We will also revisit how to better grade our results in chapter 12.

Let’s move on to other data types for now.

4.4 Working with time series

In the previous section, we covered how to represent data organized in a flat table. As

we noted, every row in the table was independent from the others; their order did not

matter. Or, equivalently, there was no column that encoded information about what

rows came earlier and what came later.

Going back to the wine dataset, we could have had a “year” column that allowed us

to look at how wine quality evolved year after year. Unfortunately, we don’t have such

data at hand, but we’re working hard on manually collecting the data samples, bottle

by bottle. (Stuff for our second edition.) In the meantime, we’ll switch to another

interesting dataset: data from a Washington, D.C., bike-sharing system reporting the

hourly count of rental bikes in 2011–2012 in the Capital Bikeshare system, along with

weather and seasonal information (available here: http://mng.bz/jgOx). Our goal

will be to take a flat, 2D dataset and transform it into a 3D one, as shown in figure 4.5.

time of day

weather

temperature

humidity

wind spEed

bike count

etc.

day 1 day 2 day 3

<-midnight - no0n - midnight->

<-midnight - no0n - midnight->

<-midnight - no0n - midnight->

weather

temperature

humidity

wind spEed

bike count

etc.

day 1

day 2

day 3

<-midnight - no0n - midnight->

weather

temperature

humidity

wind spEed

bike count

etc.

Figure 4.5 Transforming a 1D, multichannel dataset into a 2D, multichannel dataset by separating the date and

hour of each sample into separate axes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!