Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 12. MLP (IV): Programming & Implementation

Similar presentations


Presentation on theme: "Lecture 12. MLP (IV): Programming & Implementation"— Presentation transcript:

1 Lecture 12. MLP (IV): Programming & Implementation

2 Outline Matrix formulation Matlab Implementation
(C) by Yu Hen Hu

3 Summary of Equations (per epoch)
Feed-forward pass: For k = 1 to K,  = 1 to L, i = 1 to N(), t: epoch index k: sample index Error-back-propagation pass: (C) by Yu Hen Hu

4 Summary of Equations (cont’d)
Weight update pass: For k = 1 to K,  = 1 to L, i = 1 to N(), (C) by Yu Hen Hu

5 Matrix Formulation The feed-forward, back-propagation, and weight-update loops can be formulated as matrix-vector product, or matrix-matrix product operations. Many computers can implement matrix operations using special instructions (e.g. MMX) to speed up the computation and hence improve training speed. Implementation using Matlab can be made quite efficient when the algorithm is formulated in terms of matrix, vector operations rather than loops (too much overhead). (C) by Yu Hen Hu

6 Matrix Notations Z(),  = 0, 1, …, L: N()  K matrix. ith column is the outputs of neurons corresponding to the kth training sample in the th layer if  > 0, and is the training feature vector if  = 0. W(),  = 1, 2, …, L: N()  (N(1)+1) weight matrix. The (i,j)th element of W() is wij().The indices of its columns starts with 0 so that wi0() corresponds to the bias input of the ith neuron of the th layer. the activation function f()is applied to individual elements if its argument is a matrix (C) by Yu Hen Hu

7 Matrix Notations (Cont’d)
D: N(L)  K matrix of the desired output (L) = f’(U(L)).*(D  Z(L)): N(L)  K output layer delta error matrix. “.*” means element by element product of two matrices (not usual matrix-matrix product). () = f’(U()).*[W(+1)(:,2:N(+1)+1)]T (+1): N()  K matrix where W(+1)(:,2:N(+1)+1) is the last N(+1) columns of the W(+1) matrix, and []T is matrix transpose.  : noise. (C) by Yu Hen Hu

8 Matlab Implementation
bp.m (C) by Yu Hen Hu


Download ppt "Lecture 12. MLP (IV): Programming & Implementation"

Similar presentations


Ads by Google