This semester has been to follow up on the Coursera Machina learning public class, the teacher Andrew Ng is one of the founders of Coursera, machine learning aspects of Daniel. This course is a choice for those who want to understand and master machine learning. This course covers some of the basic concepts and methods of machine learning, and the programming of this course plays a huge role in mastering these concepts and methods.
Course Address https://www.coursera.org/learn/machine-learning
The main notes are a summary of the course content, as well as MATLAB programming work ....
Neural Networks
WEEK4 Programming Job Core Code
Nncostfunction.m
1%First, the original label representation of y into the vector mode output 2 Y_vect = zeros (m,num_labels); %5000x10 3 For i = 1: M, 4 y_vect (I,y (i)) = 1; 5End 6 7 a1 = [Ones (M, 1) X]; 8 z2 = A1 * Theta1 '; 9 A2 = sigmoid (z2); % x 2510 a2 = [Ones (m,1) A2]; % x 2611 z3 = A2 * Theta2 '; % x 1012 a3 = sigmoid (Z3); % 1013 x for i = 1: M15 j = j + sum ( -1*y_vect (i,:). *log (A3 (I,:))-(1-y_vect (i,:)). *log (1-A3 (I,:))); end17 j = j/m;18 j = j + lambda* (sum (SUM (Theta1 (:, 2:end). ^2)) +sum (SUM (THETA2 (:, 2:end). ^2))/2/m;%
backward Propagation Delta1 = zeros (Size (Theta1)); %
25x40122 Delta2 = zeros (Size (THETA2));%10x2623 for I=1: M24 delta3 = A3 (i,:) '-Y_vect (i,:) ';%10x125 tempTheta2 = Theta2 ' * DELTA3; % 26x10x10x1 = 26x1-Delta2 = TempTheta2 (2:end). * Sigmoidgradient (Z2 (i,:) ');%25x1 Delta2 = Delta2 + delta3 * A2 (I,: ); % 10x1x1x2628 Delta1 = Delta1 + delta2 * A1 (i,:);%25x1x1x40129 end; Theta2_grad = delta2/m; Ta1_grad = delta1/m;regularization gradient Theta2_grad (:, 2:end) = Theta2_grad (:, 2:end) + lambda * Theta2 (:, 2:end)/ m; PNs Theta1_grad (:, 2:end) = Theta1_grad (:, 2:end) + lambda * Theta1 (:, 2:end)/ m;
Sigmoidgradient.m
1 g = sigmoid (z). * (1-sigmoid (z));
Andrew Ng's Machine Learning course learning (WEEK5) Neural Network Learning