Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lab2 c

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to comment

  • Be the first to like this

Lab2 c

  1. 1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % IA % Paternon % Fecha: 34/37/15 15:30 — 17:45 hrs. % : ab2C %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % La red Adaline % Entrenamiento de la red mediante el CW % Definiendo el problema: Entrenar la seguiente red Adaline Pf[2 1 -2 -1: 2 -2 2 l] ÏÏ[0 l 0 l] % Creacion de la red Adaline % funcion: newlin help newlin % NEWLIN Create a linear layer % Syntax net = newlin(P, S,ID, LR) net = newlin(F, T,ID, LR) Description Linear layers are often used as adaptive filters for signal processing and prediction. NEWLIN(P, S,ID, LR) takes these arguments, F — RxO matrix of O representative input vectors. S - Number of elements in the output vector. ID — Input delay vector, default = [3]. LR - Learning rate, default = 3.01; and returns a new linear layer. NEWLIN(F, T,ID, LR) takes the same arguments except for T — 5x02 matrix of O2 representative 5—e1ement output vectors. NET = NEWLIN(PR, S,O, F) takes an alternate argument, F — Matrix of input vectors. and returns a linear layer with the maximum stable JPWWWWWWWWWWWWWWWW learning rate for learning with inputs P. netÏnewlin(P, I) % Funcion para determinar el objetivo net . trainParam. QOBIÏO . 01 % Pesos y bias iniciales de creación Wifnet. iw(l,1} % Con ceros Wi y bi no grafica el plotpc biÏnet. b{l) % GPE plotpv(P, T) % LSI plotpc(Wi, bi)
  2. 2. % Modificando los Pesos y bias iniciales de creación net. iw(1,l}Ï[0.5 0.5] net. b(l)f0.05 Wifnet. iw{1,1) bifnetdfll} % LSI plotpc(Wi, bi) % Si grafica % Entrenar la red netÏtrain(net, P, T) % Pesos y bias finales WfÏnet. iw{l,1) bfgnet. b(1} % GPE plotpc(Wf, bf) % Grafica % Tarea: Hacer el mismo ejercicio con el GUI % Ejercicio: Uso de las red Adaline: % Aproximador de funciones xlÏ[l -2 3 -l] x2Ï[3 2 4 -3] fÏ2*xl-x2+3 % Wi= [2 -1] % bi= l.5 % Entrenar la red Adaline % I = 2 -3 5 4 plotpv(P, T) % No grafica. No nos sirve netÏnewlin(P, I) % Pesos y bias iniciales net. iw(1,1)Ï[0.8 0.4] net. b(l)?0.7 Wifnet. iw{1,1} biÏnet. b{l} net. trainParam. goalÏO.2 netïtrain(net, P, T) Wffnet. iw{1,1} bfÏnet. b{l}
  3. 3. 35 w; = cuecuacl : «.4c««: «c= a bi = cuvcucn: e wr = ;. e929 —: =.2711 e bf = 2.4930 % s= o % I = * -3 5 4 SÏWf*P+[bf bf bf bf] % S= [l. T725 —3.335l 9.6373 3.2135] SlÏpurelin(Wf*P+[bf bf bf bf]) % Sl= S S2ÏWf*P+bf % S2=S % Tarea: Hallar el ECM de los dos ejercicios. % Tarea: Hacer el mismo ejercicio con el GUI. % Tarea: Entrenar la red Adaline: % - Con 50 iteraciones. % — Con un ECM 3.35. xl= -5:0.l:5 u¿“_5:0.l:5 % f=2xl—3x2-5 % Tarea: Entrenar la red Adaline: % — Con 100 iteraciones. % — Con un ECM 3.5. XIÏ-10:0.2:10 XZÏ-1030.1110 % f = 2 xl“2 — x2 -3

×