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.

having its corners around these perfect coordinates.

Now, we need to give each sequence of data points (corners) a label. Assuming you

can draw a square starting at any corner, and draw it without lifting your pencil at

any time, you can choose to draw it clockwise or counterclockwise. These are our

labels.

Figure 8.2 - Drawing directions

Since there are four corners to start from, and there are two directions to follow,

there are effectively eight possible sequences.

Figure 8.3 - Possible sequences of corners

Our task is to classify the sequence of corners: Is it drawn in a clockwise

direction? A familiar binary classification problem!

Let’s generate 128 random noisy squares:

Data Generation

1 points, directions = generate_sequences(n=128, seed=13)

590 | Chapter 8: Sequences

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

Saved successfully!

Ooh no, something went wrong!