Zum Inhalt springen
L

Das Video kommt von YouTube: erst beim Abspielen verbindet sich die Seite mit YouTube (Google).

Forward Propagation in a Deep Network (C1W4L02)

DeepLearningAI7:16 81.173 Aufrufe veröffentlicht Auf YouTube

Das Wichtigste aus dem Video

Tipp auf eine Zeit – das Video springt genau dorthin.

Transkriptautomatisch erstellt · 36 Zeilen
Herunterladen
  1. in the last video we described what is the deep l-larry neural network and also talked about the notation we use to describe such networks in this video you
  2. see how you can perform fold propagation in a deep network as usual let's first go over what forward propagation will look like for a single training example
  3. X and then later on we'll talk about the vectorized version where you want to carry out forward propagation on the entire training set at the same time but
  4. um given a single training example X here's how you compute the activations of the first layer so for this first layer you compute v1 equals W 1 times X
  5. plus b1 so W 1 and B 1 that parameters that affect the activations in layer 1 right where this is layer 1 of the neural network and then you compute the
  6. activations for that layer to be equal to G of Z 1 and the deactivation function G depends on what layer you're at and maybe index AB has the activation
  7. function from layer 1 so if you do that you've now computed the activations from there 1 how about layer to say that there well
  8. you would then compute v2 equals W to a 1 plus B 2 and then so the observation of layer 2 is the way matrix times the outputs of layer 1 so that value plus
  9. the bias vector for layer 2 and then a2 equals the activation function apply to z2 ok so that's it for layer 2 and so on and so forth until you get to the output
  10. layer that's layer 4 where you would have that V 4 is equal to the parameters for that layer times the activations from the previous layer
  11. Plus that bias vector and then similarly a four equals G of v4 and so that's how you you know compute your estimated output Y hat so just one thing to notice
  12. X here is also equal to a zero because the input feature vector X is also the activations of layer 0 so we scratch out X I'm going to cross out X and put a 0
  13. here then you know all of these equations basically look the same right the general rule is that ZL is equal to WL times a of L minus 1 plus B L 1 there
  14. and then the activations for that layer is the activation function applied to the values Z so that's the general for propagation equation so we've done all
  15. this for a single training example how about for doing it in a vectorized way for the whole training set at the same time the equations look quite similar as
  16. before for the first layer you would have Capital Z 1 equals W 1 times capital X plus B 1 and then a 1 equals G of Z 1 right and bear in mind that X is
  17. equal to a 0 these are just Neil the training examples stacked in different columns you could take this let me scratch out X we can put a 0 there and
  18. then for the next layer a little similar Z 2 equals W 2 A 1 plus B 2 and a 2 equals G of Z 2 right we just take these vector Z or a and so on and
  19. stacking them up so this is V vector for the first training example V vector for the second training example and so on down to the M training example and
  20. stacking these and columns and calling this capital V alright and similarly for capital A just as capital X all the training examples are column vectors
  21. snacks left to right and then they then end of this process you end up with y hat which is equal to G of Z 400 this is also equal to a 4 and that's the
  22. predictions on all the new training examples of stand horizontally so just to summarize our notation I'm going to modify this up here our notation allows
  23. us to replace lowercase Z and a with the uppercase counterparts it already looks like a capital D and that gives you the vectorized version of forward
  24. propagation that you carry out on the entire training set at a time where a 0 is X now if you look at this implementation of vectorization it looks
  25. like that there is going to be a for loop here where it says left for l equals 1 to 4 for l equals 1 through capital l then you have to compute the
  26. activations for layer 1 and the layer 2 then for layer 3 and they're gentle therefore so since that there is a for loop here and I know that when
  27. implementing your networks we usually want to get rid of explicit for loops but this is one place where I don't think there's any way to implement this
  28. other than explicit for loop so we're implementing for propagation it is perfectly okay to have a for loop that compute the activations for layer 1 then
  29. there are 2 then they are threes and therefore no one knows and I don't think there is this any way to do this without a for loop that goes from 1 to capital L
  30. from 1 through the total number of layers and in your network so this place is perfectly okay to have an explicit folder so
  31. that's it for the notation for deep neural networks as well as how to do forward propagation in these networks if the pieces we've seen so far looks a
  32. little bit familiar to you that's because what we're seeing is taking a piece very similar to what you see in in the neural network with a single hidden
  33. layer and just repeating that more times now it turns out that we implemented deep neural network one of the ways to increase your odds of having a bug-free
  34. implementation is to think very systematic and carefully about the matrix dimensions you're working work so when I'm trying to develop my own code
  35. I'll often pull a piece of paper and just think carefully through so the dimensions of the matrix I'm working with let's see how you could do that in
  36. the next video