22.02.2024 Views

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

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

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

Figure 8.14 - Final hidden states for eight sequences of the "perfect" square

For clockwise movement, the final hidden states are situated in the upper-left

region, while counterclockwise movement brings the final hidden states to the

lower-right corner. The decision boundary, as expected from a logistic regression,

is a straight line. The point closest to the decision boundary—that is, the one the

model is less confident about—corresponds to the sequence starting at the B corner

(green) and moving clockwise (+).

"What about the other hidden states for the actual sequences?"

Let’s visualize them as well. In the figure below, clockwise sequences are

represented by blue points and counterclockwise sequences, by red points.

Figure 8.15 - Sequence of hidden states

We can see that the model already achieves some separation after "seeing" two data

points (corners), corresponding to "Hidden State #1." After "seeing" the third

corner, most of the sequences are already correctly classified, and, after observing

Recurrent Neural Networks (RNNs) | 621

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

Saved successfully!

Ooh no, something went wrong!