% % Written by: % -- % John L. Weatherwax 2009-04-21 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- W = [ 0, 0, 0; 3, -1, 2; 1, 2, 0 ]; x = [ 1; 1; 3 ]; t = W * x ; h = 1./( 1 + exp(-t) ) U = [ -3, 1, -2 ]; t = U * h y_1 = 1./( 1 + exp( -t ) ) % the error signals delta y_1, delta h_1, and delta h_2 : d_1 = 0.9; dy_1 = ( y_1 - d_1 ) * y_1 * ( 1 - y_1 ) % delta y_1 j=1; dh_1 = ( y_1 - d_1 ) * y_1 * ( 1 - y_1 ) * U(1,j+1) * h(j+1) * ( 1 - h(j+1) ) j=2; dh_2 = ( y_1 - d_1 ) * y_1 * ( 1 - y_1 ) * U(1,j+1) * h(j+1) * ( 1 - h(j+1) ) % compute the weight updates % eta = 1.; Delta_u = - dy_1 * (h') mu = 1.; Delta_w = - mu * [ dh_1; dh_2 ] * (x')