22.02.2024 Views

Daniel Voigt Godoy - Deep Learning with PyTorch Step-by-Step A Beginner’s Guide-leanpub

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

And then let’s visualize the first ten squares:

fig = plot_data(points, directions)

Figure 8.4 - Sequence dataset

The corners show the order in which they were drawn. In the first square, the

drawing started at the top-right corner (corresponding to the blue C corner) and

followed a clockwise direction (corresponding to the CDAB sequence).

In the next chapter, we’ll use the first two corners to predict the

other two, so the model will need to learn not only the direction

but also the coordinates. We’ll build a sequence-to-sequence

model that uses one sequence to predict another.

For now, we’re sticking to classifying the direction, given all four data points of a

given square. But, first, we need to introduce…

Recurrent Neural Networks (RNNs)

Recurrent neural networks are perfectly suited for sequence problems since they

take advantage of the underlying structure of the data, namely, the order of the

data points. We’ll see in great detail how the data points, sequentially presented to

a recurrent neural network, modify the RNN’s internal (hidden) state, which will

ultimately be a representation of the full sequence.

SPOILER ALERT: Recurrent neural networks are all about

producing a hidden state that best represents a sequence.

Recurrent Neural Networks (RNNs) | 591

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

Saved successfully!

Ooh no, something went wrong!