完整編程作業代碼 GitHub 地址:https://github.com/coco-1998-2/Andrew-NG-Machine-Learning-Coursera
100%本地運行通過,不要直接拷貝,debug有問題的時候參考下就好。若是感覺有用,別忘記Star哦~
1.Question 1
You are training a three layer neural network and would like to use backpropagation to compute the gradient of the cost function. In the backpropagation algorithm, one of the steps is to update
for every i, ji,j. Which of the following is a correct vectorization of this step?
Correct
This version is correct, as it takes the "outer product" of the two vectors \delta^{(3)}δ(3) and a^{(2)}a(2) which is a matrix such that the (i,j)(i,j)-th entry is \delta^{(3)}_i * (a^{(2)})_jδi(3)∗(a(2))j as desired.
2.Question 2
Suppose 𝚃𝚑𝚎𝚝𝚊𝟷 is a 5x3 matrix, and 𝚃𝚑𝚎𝚝𝚊𝟸 is a 4x6 matrix. You set 𝚝𝚑𝚎𝚝𝚊𝚅𝚎𝚌=[𝚃𝚑𝚎𝚝𝚊𝟷(:);𝚃𝚑𝚎𝚝𝚊𝟸(:)]. Which of the following correctly recovers 𝚃𝚑𝚎𝚝𝚊𝟸?
𝚛𝚎𝚜𝚑𝚊𝚙𝚎(𝚝𝚑𝚎𝚝𝚊𝚅𝚎𝚌(𝟷𝟼:𝟹𝟿),𝟺,𝟼)
𝚛𝚎𝚜𝚑𝚊𝚙𝚎(𝚝𝚑𝚎𝚝𝚊𝚅𝚎𝚌(𝟷𝟻:𝟹𝟾),𝟺,𝟼)
𝚛𝚎𝚜𝚑𝚊𝚙𝚎(𝚝𝚑𝚎𝚝𝚊𝚅𝚎𝚌(𝟷𝟼:𝟸𝟺),𝟺,𝟼)
𝚛𝚎𝚜𝚑𝚊𝚙𝚎(𝚝𝚑𝚎𝚝𝚊𝚅𝚎𝚌(𝟷𝟻:𝟹𝟿),𝟺,𝟼)
𝚛𝚎𝚜𝚑𝚊𝚙𝚎(𝚝𝚑𝚎𝚝𝚊𝚅𝚎𝚌(𝟷𝟼:𝟹𝟿),𝟼,𝟺)
Incorrect
Since Octave indexing starts at 1, 𝚝𝚑𝚎𝚝𝚊𝚅𝚎𝚌(𝟷𝟻:𝟹𝟾) starts at the last element of 𝚃𝚑𝚎𝚝𝚊𝟷instead of the first element of 𝚃𝚑𝚎𝚝𝚊𝟸.
3.Question 3
4.Question 4
5.Question 5