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.

Using a neural

network to fit the data

This chapter covers

• Nonlinear activation functions as the key

difference compared with linear models

• Working with PyTorch’s nn module

• Solving a linear-fit problem with a neural network

So far, we’ve taken a close look at how a linear model can learn and how to make

that happen in PyTorch. We’ve focused on a very simple regression problem that

used a linear model with only one input and one output. Such a simple example

allowed us to dissect the mechanics of a model that learns, without getting overly

distracted by the implementation of the model itself. As we saw in the overview diagram

in chapter 5, figure 5.2 (repeated here as figure 6.1), the exact details of a

model are not needed to understand the high-level process that trains the model.

Backpropagating errors to parameters and then updating those parameters by taking

the gradient with respect to the loss is the same no matter what the underlying

model is.

141

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

Saved successfully!

Ooh no, something went wrong!