Nov-22-2018, 07:54 PM
Hello,
I have this code after the modification of W I want to obtain the new value of E.I use the for loop but the value stay the same of the first iteration.
Please who have any idea about that.
import numpy as np Yd =0.4 lamda=10 delt =0.1 x1=0.8 x2=0.2 w01=w02=w03=w11=w12=w13=w21=w22=w23=0 W= np.array ([[w01],[w02],[w03],[w11],[w12],[w13],[w21],[w22],[w23]]) for i in range (100): y1 = ( w01+ w11*x1+w21*x2) y2=(w02+w12*x1+w22*x2) Z = ((np.array([[w03,w13,w23]])).dot (np.array([[1],[y1],[y2]]))) E=(Z-Yd) print(E) dw01=w13 dw02=w23 dw03=1 dw11=w13*x1 dw12=w23*x1 dw13=w01+w11*x1+w21*x2 dw21=w13*x2 dw22=w23*x2 dw23=w02+w12*x1+w22*x2 F= (np.array([[dw01,dw02,dw03,dw11,dw12,dw13,dw21,dw22,dw23]])) FT = (np.transpose(F)) cte= (- FT.dot(F.dot(FT) ** (-1))*lamda*E) W=W+delt*cte