Hello, can anyone explain the following concept mentioned in the coding assignment:
How do you get 64 features from the input layer? So the way I am understanding is there are 4 input features - which are the distance in miles, is_rush_hour, time_of_day, total_time. How does the first hidden layer get 64 features and the second hidden layer get 32 features? I am assuming the single output layer is going to determine whether to deliver or not?
Sorry very new to this.
A linear layer can have any number of inputs and any number of outputs: for the very first layer of the network, the number of inputs is determined by your data. But for the output of that first layer, that is a design choice that you make. Once you know the number of inputs and outputs, then it’s just a question of understanding the API for torch.nn.Linear, which is covered in the assignment. Of course once you have chosen the number of output neurons for the first linear layer, that determines the inputs to the second layer. Then you need to choose the output dimension of the second layer and so forth …
Note that this course is not intended for people who are new to the various types of Neural Networks. Continuing C1 of the PyTorch courses, we will soon encounter Convolutional Layers which are more advanced than Linear Layers. This course assumes you already know about Neural Nets and then shows you how to build them specifically in PyTorch.
If this is your first exposure, it might be a better idea to start with MLS and DLS. Those courses teach you about the various types of networks and show you how to build them directly in python and then in TensorFlow, which is another “framework” like PyTorch.
1 Like
Thank you. I will review the NN concepts again.
The example here is a little contrived in that there are only 4 input features, but the way they constructed a 3 layer Fully Connected NN is pretty typical of a relatively simple classifier network.
1 Like