吴恩达 ML 公开课笔记(9)-Programming Exercise 3
Contents
Programming Exercise 3
Multi-class Classification
- CostFunction for fmincg
|
|
- The same as is in Programming Exercise 2
- One-vs-all Classification
|
|
- ONEVSALL trains multiple logistic regression classifiers and returns all the classifiers in a matrix all_theta, where the i-th row of all_theta corresponds to the classifier for label i
- The parameter
y == iter
returns a vector of the same size as y with ones at positions where the elements of y are equal to iter and zeroes where they are different.
- One-vs-all Prediction
|
|
- Notice that the max element’s column-index in each row of
X*all_theta'
happensto be the number it represents(10 for 0)
- Main Function
|
|
Neural Networks
- Feedforward Propagation and Prediction
|
|
- The parameters of each layer has already been trained into Theta1 and Theta2
- Each column of the output layer a_3 is the output for each row of X, which is each row-vectorized picture.
- The prediction part, especially
[values, p] = max(a_3)
works the same as One-vs-all Prediction function, except for the row-index rather than column-index.
- Main Function
|
|