Title | 2. Ejemplo 1 - Perceptron Multicapa |
---|---|
Course | Intelegencia Artificial |
Institution | Universidad Popular del Cesar |
Pages | 18 |
File Size | 447.5 KB |
File Type | |
Total Downloads | 36 |
Total Views | 176 |
Ejemplos de la elaboracion de un algoritmo de red neuronal llamado percetron unicapa...
Ejercicios resueltos de redes neuronales – Perceptron Multicapa 1. … Neurona de entrada 1 2 3 4
1 2 3 4 5 6 7 8 9
Síntoma
Valor 0
Valor 1
Dolor de cabeza Fiebre Tos Dolor de rodilla
No No No No
Si Si Si Si
x1
x2
x3
x4
yd 1
yd 2
1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1
1.2 2,2 3.2 4.2 5.2 6.2 7.2 8.2 9.2
1.3 2.3 3.3 4.3 5.3 6.3 7.3 8.3 9.3
1.4 2.4 3.4 4.4 5.4 6.4 7.4 8.4 9.4
1 1 1 0 1 1 0 0 1
0 1 1 0 1 1 0 0 0
Solución
Entradas = 4 Salidas = 2 Patrones = 10
1. Definir parámetros de entrenamiento Número de capas [0…3] = 3 Número de neuronas para la capa 1= 6 Número de neuronas para la capa 2= 5 Número de neuronas para la capa 3= 4 Número de iteraciones = 1000 Rata de aprendizaje [0...1] = α = 1
Rata de aprendizaje dinámica
Error máximo permitido = 0.01
2. Crear e inicializar la red 2.1. Presentar el vector de entrada
μ → R . A=
1 It
2.2. Inicializar pesos y umbrales
[
0.1 0.2 WE 4 x 6= 0.3 0.4
0.2 0.3 0.4 0.5
0.3 0.4 0.5 0.6
0.4 0.5 0.6 0.1
0.5 0.6 0.1 0.2
U 1i=[ 0.1 0.2 0.3 0.4 0.5 0.6]
[
0.1 0.2 0.3 WF 6 x 5= 0.4 0.5 0.1
0.2 0.3 0.4 0.5 0.1 0.2
0.3 0.4 0.5 0.1 0.2 0.3
]
0.4 0.5 0.1 0.2 0.3 0.4
0.5 0.1 0.2 0.3 0.4 0.5
U 2J =[0.1 0.2 0.3 0.4 0.5 ]
[
0.1 0.2 WG5 x 4 = 0.3 0.4 0.1
0.2 0.3 0.4 0.1 0.2
0.3 0.4 0.1 0.2 0.3
0.4 0.1 0.1 0.3 0.4
U 3K =[ 0.1 0.2 0.3 0.4 ]
[ ]
0.1 WS 4 x2= 0.3 0.5 0.7
0.2 0.4 0.6 0.8
]
]
0.6 0.1 0.2 0.3
UsL =[ 0.1 0.2 ] m=4(Entrada) n=6(1 °capa oculta) ñ=5 ( 2° capa oculta ) 0=4 (3 °capa oculta) p=2( salida ) 3. Iniciar el entrenamiento Patrón 1 3.1. Calculamos la salida de la red (Patrón 1)
[∑ ( [∑ ( [∑ ( m
h 1i=∂
x h ∙WE hi) −U 1i
h=1
]
i =1.. n
n
h 2 j=∂
h 1i ∙ WF ij )−U 2J
i=1
]
ñ
h 3k =∂
[
j =1
h 2 j ∙WG jk )−U 3k
o
S L =∂ ∑ ( h 3k ∙WSkL ) −Us L k=1
j=1.. ñ
]
k=1..o
]
L =1.. p
Para
[ [∑ ( m
h 1i=∂
] ]
( x h ∙WE hi) −U 1i ∑ i =1.. n h=1 4
h 11=∂
x h ∙WE hi) −U 1i
h=1
i =6
h 11=( x 1 ∙ WE11 ) +( x 2 ∙ WE21 )+ ( x 3 ∙ WE 31 )+ ( x 4 ∙ WE 41)
h 11=(1.1 ∙ 0.1 ) +( 1.2 ∙ 0.2 )+ (1.3 ∙ 0.3 ) + (1.4 ∙ 0.4 ) h 11=1.3 h 11=h 11−U 11
h 11=1.3− 0.1 h 11=1.2 h 12=( x 1 ∙ WE12 ) +( x 2 ∙ WE 22 )+ ( x3 ∙WE 32 )+ ( x 4 ∙WE 42 )
h 12=(1.1 ∙ 0.2 ) +( 1.2 ∙ 0.3 )+ ( 1.3 ∙ 0.4) + ( 1.4 ∙ 0.5) h 12=1.8 h 12=h 12−U 12
h 12=1.8− 0.2
h 12=1.6 h 13=( x 1 ∙ WE13 ) +( x 2 ∙WE 23 ) +( x 3 ∙ WE33 )+ ( x 4 ∙ WE 43) h 13=(1.1 ∙ 0.3 ) +( 1.2 ∙ 0.4 )+ ( 1.3 ∙ 0.5) + ( 1.4 ∙ 0.6) h 13=2.3
h 13=h 13−U 13 h 13=2.3 −0.3
h 13=2 h 14=( x1 ∙WE 14 ) +( x 2 ∙ WE 24 )+ ( x 3 ∙ WE34 ) +( x 4 ∙ WE 44 ) h 14=(1.1 ∙ 0.4 ) +( 1.2 ∙ 0.5 ) + (1.3 ∙ 0.6 )+ (1.4 ∙ 0.1 ) h 14=1.96
h 14=h1 4−U 14 h 14=1.96 −0.4
h 14=1.56 h 15=( x 1 ∙ WE15 ) +( x 2 ∙WE 25 ) +( x 3 ∙ WE35 )+ ( x 4 ∙ WE 45) h 15=(1.1 ∙ 0.5 ) +( 1.2 ∙ 0.6 )+ ( 1.3 ∙ 0.1) + (1.4 ∙ 0.2 ) h 15=1.68
h 15=h 15−U 14 h 15=1.68− 0.5
h 15=1.18 h 16=( x 1 ∙ WE 16) +( x 2 ∙WE 26 ) +( x 3 ∙ WE 36)+ ( x 4 ∙WE 46 ) h 16=(1.1 ∙ 0.6 ) +( 1.2 ∙ 0.1 )+ ( 1.3 ∙ 0.2) + (1.4 ∙ 0.3 ) h 16=1.46
h 16=h 15−U 14 h 16=1.46 −0.6
h 16=0.86
Aplicamos la función de activación (Simoidal)
h 11=
1 1+e−h1
1
1 h 11 = 1+ e−1.2
h 11=0.768524783499 h 12=
1 1+e−h1
h 12=
1 1+e−1.6
2
h 12=0.8320183851339 h 13=
1 1+e−h 1
3
h 13=
1 1+e−2
h 13=0.8807970779779 h 14=
1 −h 1 1+e
4
1 h 14 = −1.56 1+e h 14= 0.826353352981 h 15=
1 1+e−h 1
5
h 15=
1 1+e−1.18
h 15=0.7649478037638 1 h 16 = −h 1 1+ e
6
1 h 16 = −0.86 1+e h 16=0.7026606543447
[ [∑ ( n
h 2 j=∂
∑ (h 1i ∙ WF ij )−U 2J i=1 6
h 2 j=∂
h 1i ∙ WF ij )−U 2J
i=1
] ]
j=1.. ñ
j=5
h 21=(h 11 ∙ WF 11 ) +( h12 ∙WF 21) +( h13 ∙WF 31 ) + ( h 14 ∙ WF 41 ) + ( h 15 ∙ WF 51) + ( h 16 ∙ WF 61 )
h 21=(0.768524783499 ∙ 0.1 ) +( 0.8320183851339 ∙ 0.2 )+ ( 0.8807970779779 ∙ 0.3) + ( 0.826353352981 ∙ 0.4 ) + h 21=1.2907765872788 h 21=h 21−U 21
h 21=1.2907765872788−0.1 h 21=1.1907765872788 h 22=(h 11 ∙ WF 12 ) +( h 12 ∙ WF 22 )+ ( h 13 ∙ WF 33) + ( h 14 ∙WF 42 ) + ( h15 ∙WF 52 ) + ( h16 ∙WF 62 )
h 22=(0.768524783499 ∙ 0.2 ) +( 0.8320183851339 ∙ 0.3 ) +( 0.8807970779779 ∙ 0.4) + ( 0.826353352981 ∙ 0.5 ) + h 22=1.385832891167 h 22=h 22−U 22
h 22=1.385832891167 −0.2 h 22=1.185832891167 h 23=(h 11 ∙WF 13 ) +( h 12 ∙ WF 23 ) +( h 13 ∙ WF 33) + ( h 14 ∙ WF 43 ) + ( h 15 ∙ WF 53) + ( h 16 ∙ WF 63 )
h 23=(0.768524783499 ∙ 0.3 ) +( 0.8320183851339 ∙ 0.4 ) + ( 0.8807970779779 ∙ 0.5) + ( 0.826353352981 ∙ 0.1 ) + h 23=1.4501864204465 h 23=h 23−U 23
h 23=1.4501864204465− 0.3 h 23=1.1501864204465 h 24 =( h 11 ∙ WF 14 )+ ( h 12 ∙ WF 24 ) + (h 13 ∙WF 34 ) +( h1 4 ∙ WF 44 ) +( h15 ∙WF 54 )+ (h 16 ∙ WF 64 )
h 24 =( 0.768524783499 ∙ 0.4 )+ (0.8320183851339 ∙ 0.5 ) + ( 0.8807970779779 ∙ 0.1) + ( 0.826353352981 ∙ 0.2 ) + h 24 =1.4873180872276 h 24 =h 24−U 24
h 24 =1.4873180872276−0.4 h 24 =1.0873180872276 h 25=(h 11 ∙WF 15 ) +( h 12 ∙ WF 25 ) +( h 13 ∙ WF 35) + ( h 14 ∙ WF 45 ) + ( h 15 ∙ WF 55) + ( h 16 ∙ WF 65 )
h 25=(0.768524783499 ∙ 0.5 ) +( 0.8320183851339 ∙ 0.1 ) +( 0.8807970779779 ∙ 0.2 ) + ( 0.826353352981 ∙ 0.3) + h 25=1.5488391004306 h 25=h 25−U 25
h 25=1.5488391004306− 0.5 h 25=1.0488391004306
Aplicamos la función de activación (Simoidal)
h 21= h 21=
1 1+e−h 2
1
1 −1.1907765872788
1+e
h 21=0.7668799274735 h 22=
1 1+e−h 2
2
1 h 22 = −1.185832891167 1+ e h 23=0.7659949518747 h 23=
1 1+e−h 2
3
h 23=
1 −1.1501864204465
1+e
h 23=0.7595449657577 1 h 24 = −h 2 1+e
4
1 h 24 = −1.0873180872276 1+e h 24 =0.7478763636096 h 25= h 25=
1 1+e−h 2
5
1 −1.0488391004306
1+e
h 25=0.7405519122973
[ [∑ ( ñ
h 3k =∂ ∑ ( h 2 j ∙WG jk )−U 3k j =1 5
h 31=∂
j=1
h 2 j ∙WG jk ) −U 3k
] ]
k=1..o
k=4
h 31=( h21 ∙WG 11)+ ( h 22 ∙WG21 ) +( h23 ∙WG 31) + ( h 24 ∙WG 41) +( h 25 ∙ WG51) h 31=(0.7668799274735 ∙ 0.1 ) + ( 0.7659949518747 ∙ 0.2 ) +( 0.7595449657577 ∙ 0.3) +( 0.7478763636096 ∙ 0.4
h 31=0.8309562095232 h 31=h 31−U 3 1
h 31=0.8309562095232− 0.1 h 31=1.1907765872788 h 32=( h21 ∙WG 12)+ ( h22 ∙WG 22 ) + (h 23 ∙ WG32 ) + ( h 24 ∙WG 42 )+ (h 25 ∙ WG52 )
h 32=(0.7668799274735 ∙ 0.2 ) + ( 0.7659949518747 ∙ 0.3 ) +( 0.7595449657577 ∙ 0.4) +( 0.7478763636096 ∙ 0.1 h 32=0.9098904761806 h 32=h 32 −U 3 2
h 32=0.9098904761806 −0.2 h 32=0.7098904761806 h 33=( h21 ∙WG 13)+ ( h 22 ∙ WG23 ) + (h 23 ∙ WG33 ) + ( h2 4 ∙ WG43 )+ (h25 ∙ WG53 )
h 33=(0.7668799274735 ∙ 0.3 ) + ( 0.7659949518747 ∙ 0.4 ) + (0.7595449657577 ∙ 0.1) +( 0.7478763636096 ∙ 0.2 h 33=0.9098904761806 h 33=h 33 −U 33
h 33=0.9098904761806 −0.3 h 33=0.6098904761806 h 34 =( h 21 ∙ WG13) +( h 22 ∙WG23 ) + (h23 ∙ WG33 ) +( h 24 ∙WG 43 ) +(h 25 ∙ WG53 )
h 34 =( 0.7668799274735 ∙ 0.4 ) +( 0.7659949518747 ∙ 0.1 ) + (0.7595449657577 ∙ 0.2) +( 0.7478763636096 ∙ 0.3 h 34 =1.0558441333302 h 34 =h 34 −U 34
h 34 =1.0558441333302−0.4 h 34 =0.6558441333302
Aplicamos la función de activación (Simoidal)
1 h 31 = −h 3 1+ e h 31=
1
1 −1.1907765872788
1+e
h 31=0.7668799274735
h 32=
1 1+e−h 3
2
h 32=
1 1+e−0.7098904761806
h 32=0.6703769585968
h 33=
1 1+e−h 3
3
1 h 33 = −0.6098904761806 1+e h 33=0.647915817812
1 h 34 = −h 3 1+ e
4
1 h 34 = −0.6558441333302 1+ e h 34 =0.6583262136984
[ [∑ ( o
S L =∂ ∑ ( h 3k ∙WSkL ) −Us L k=1 4
S L =∂
h 3k ∙WSkL ) −Us L
k=1
] ]
L =1.. p
L =2
S 1=( h 31 ∙WS 11 )+ (h 32 ∙ WS 21 ) + ( h 33 ∙ WS 31 ) +( h 34 ∙ WS 41)
S 1=( 1.1907765872788 ∙ 0.1) + ( 0.7098904761806 ∙ 0.3) + ( 0.6098904761806 ∙ 0.5) + ( 0.6558441333302 ∙ 0.7) S 1=1.0960809330035 S 1=S1−US 1
S 1=1.0960809330035−0.1 S 1=0.9960809330035 S 2=( h31 ∙WS 12 )+ (h 32 ∙WS 22 ) + ( h 33 ∙WS 32 ) +( h 3 4 ∙ WS 42)
S 2=( 1.1907765872788 ∙ 0.2) + ( 0.7098904761806 ∙ 0.4 )+ ( 0.6098904761806 ∙ 0.6 ) + ( 0.6558441333302 ∙ 0.8) S 2=1.4127211003005 S 2=S2−US2
S 2=1.4127211003005 −0.2 S 2=1.2127211003005
Aplicamos la función de activación (Escalon)
Si S i ≥ 0 entonces yri =1 Si S i...