He Mo Va Mang Noron

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View He Mo Va Mang Noron as PDF for free.

More details

  • Words: 4,511
  • Pages: 27
11

CHUONG 2.

HE. MO vA MANG NORON . t)~.K~ .TlJ.

;:

N~ ~-E ' -'" .

1"11 V3EN 1 .

.

O~OO908J Ngay nay, ly thuy~t v€ t~p ma va logic ma, cling nhu ly thuy~t v€ m~ng rOTondffkhong con la di€u m6i me v6i mQinguai nua. Chuang nay khong co tham vQngtrinh bay mQiv~n d€ lien quail d~n h~ ma va m~ng naron, ma chi xin lieUlen m9t s6 khai ni~m ca bfm nh~t, co lien quail tI"\lCti~p d~n vi~c xiiy d\rng mo hinh h6 trq ra quy~tdinh sau nay.

I. H~ MO (FUZZY SYSTEM): Trong vai th~p leYqua, cac h~ th6ng ma da:lam m9t CU9Cthay th~ "ngo~n m\lc" cac ky thu~t thong thuang trong nhi€u 11nhV\lCkhac nhau cua khoa hQc va cong ngh~, d~c bi~t la trong di€u khi~n va nh~n d~ng. Logic ma dffduqc sir d\mg I

I .

h~t suc hi~u qua trong hang lo~t 11nhV\lC,ill cac san phfun tieu dung va d~n cac h~

-

,

thong cong nghi~p. Cling v6i ky thu~t ma do, cong ngh~ thong tin trong ho trq ra

I quy~tdinh va cac h~ chuyen gia da:tim l~i duqc suc s6ng cua minh, v6i kha nang I

l~p lu~n h~t suc hi~u qua tren m9t s6 luqng t6i thi~u cac lu~t duqc cling c~p b6i h~mO'.

1. T{ip mil (Fuzzy Set): T~p ma A trong t~p vu tr\l U duqc dinh nghla b6i mQtc~p thu tv: A = { (x, JlA(X))/ x E U}

!lA(.)duqc gQila ham thanh vien cua t~p ma A.

(2.1)

12

J.1A(X) la dQthuQc cua x trong t~p ma A. J.1.

A

1

0

x IDnh 2.1. Ham thanh vien cua t~p ma A

1.1. Cae phep tmiDireD t~p ma: Cho 2 t~p ma A, B trong t~p vii t11,1 U.

- Phepbli: Khi J.1A(X)E [0, 1] . Bli cua t~p ma A - ki hi~u A J.1A(X) = 1 - J.1A(X)

- co ham thanh vien:

'v'XEU

(2.2)

- Phep giao:

Giaocua 2 t~pma A va B - ki hi~u A n B - co ham thanh vien: J.1An B (x)

= mill

[J.1A(X), J.1B(X)] = J.1A(X)/\ J.1B(X)

'v'XEU

(2.3)

- Phep hQi: HQicua 2 t~p ma A va B - ki hi~u A u B - co ham thanh vien: J.1Au B (x) = max [J.1A(X),J.1B(X)]

=

J.1A(X) V J.1B(X)

'v'XEU

(2.4)

- B~ng nhau: Hai t~p ma A va B b~ng nhau khi va chi khi: J.1A(X) = J.1B(X)

'v'XEU

(2.5)

- T~p con: T~p ma A gQila con cua t~p ma B - ki hi~u A c B - khi va chi khi: IlA(X) :::;IlB(X)

'v'XEU

(2.6)

13

- Phu dinh eua phu dinh: -

A=A

(2.7)

- Lu~t DeMorgan:

-

--

AuB=AnB

(2.8)

-AnB=AuB

(2.9)

AuA:;i:U

va

A nA:;i:0

(2.10)

1.2. Cae tinh eh§t eua t~p mir: Cho 3 t~p ma A, B, C tren t~p vii tIVU. - Giao hmln:

AuB=BuA

(2.11)

AnB=BnA

- K~thqp: Au (B u C) = (A u B) u C

(2.12)

An (B n C) = (A n B) n C - Phfm ph6i:

Au (B n C) = (A u B) n (A u C)

(2.13)

An (B u C) = (A n B) u (A n C)

- B~e e~u: N~u A c B c C thi A c C

(2.14)

- Cae tinh chat khae: AuA=A AnA=A

(2.15)

14

Au0=A

(2.16)

An0=0

AuU=U

(2.17)

AnU=A 1.3. Bi~u di~n t~p mir: Cho t~p vii tf\l U = {x, xl, X2,..., xn}. Cho t~p ma A co ham thanh vien !lA. T~p ma A duQ'cbi~u di~n: A = { (Xl, !lA(XI)),(X2,!lA(X2)),..., (xn, !lA(Xn))}

(2.18)

N~u U f<Jir~c thi A co th~ vi~t: n

A= Ill/Xl + !l2/X2 +...

+ !In/Xn=

LJli/X;

(2.19)

;=1

Trong do, phep "+" la h<)icua cac phfu1ill. N~u U lien tvc thi A bi~u di~n:

A= LJlA(X)lx

(2.20)

2. Logic mil va l~p lu~n xdp xi (Fuzzy Logic - Approximate Reasoning) : 2.1. Bi~n ngon ngft (Linguistic Variables): Bi~n ngon ngil' la m<)tkhai ni~m quail trQngtrong logic ma va I~p lu~ xAp xi. No dong vai tro then ch6t trong nhi€u tmg dvng, d~c bi~t la trong cac h~ chuyen gia fia va di€u khi~n mO'. Bi~n ngon ngil' la m<)t bi~n ma gia tri cua no la tir (word) hay diu (sentence)trong ngon ngil'tv nhien. Thi d1}:"T6c d<)"la m<)tbi~n ngon ngil' n~u no lAycac gia tri: "ch~m", "nhanh", "rAtnhanh" ...

15

Khai ni~m bi~n ngon ngu d~ xuAt b6'i Zadeh, su d\mg nhu m(}tphuang ti~n d~ xApxi khi din hy sinh m(}t chut d(}chinh xac (khong cAn thi~t) d~ tranh duQ'c S\T phue t~p qua mue luc mo tit m(}thi~n tUQ'llg,vAn d~ [9]. Biin mu (Fuzzy variable): mo tit b6'i b(}ba (X, U, R(X))

(2.21)

X: ten eua bi~n U: t~p vu tr\l R(X): t~p mo con eua U, bi~u di~n m(}tgi6i h~ mo (fuzzy restriction) ap d~ttren X. Thi d\l: X = "Gia" U = {1O,20, ..., 80} R(X) = 0.1/20 + 0.2/30 + 0.4/40 + 0.5/50 + 0.8/60 + 1/70+ 1/80

Bi~n ngon ngu co thu b~c cao han bi~n mo: No lAycac bi~n mo lam gia tri euaminh. MQtbi~n ngon ngu mo tit b6'ib(}ni'im: (x, T(x), U, G, M)

(2.22)

x: ten cua bi~n T(x): t~p hQ'Pcae ten cua bi~n ngon ngu cua x ma gia tri cua no la cac bi~n mb'tren U. G: lu~t eu phap d~ sinh ra ten cua cac gia tri cua x

M: lu~t ngu nghla d~ k~t hQ'Pm6i gia tri cua x v6i nghla eua no. Thi d\l: x: bi~n ngon ngu "T6e d(}" - lAygia tri tren U = [0, 100]

T(x) = T(t6c d(})= {RAT Ch~m, Ch~m, Vila, Nhanh ...}

16

Lu~t G d€ sinh ra cae ten (nhan) cua cae thanh phAn cua T(t6c dQ) hinh thanh b~ngtf\l'cgiac. Lu~t M dinh nghia nhu sau: M (Ch~)

= T~p ma mo ta "mQt t6c dQ khoang du6i 40 km/h" v6i ham

thanh vien 11Ch~

M (Vira) = T~p ma mo ta "mQt t6c dQ gAll55 kmIh" v6i ham thanh vien /lVira

M (Nhanh) = T~p ma mo ta "mQt t6c dQ khoang tren 70 km/h" v6i ham thinh vi en IlNhanh

11

I

0.5

IlVira

Ilch

J

IlNhanh

I-

0 40

55

70

T6c dQ (km/h)

Hinh 2.2. Cac gia tri cua bi€n ligon ngu "T6c dQ" 2.2. Logic mO': Trong logic c6 di€n, chilli tri la mQt trong hai gia tri: DUNG hoi.ic SA!. Logic ma Ii ma rQng cua logic c6 di€n, trong do, cae chiin tri la cae gia tri cua bi€n ngon ngu DUNG [9].

17

Kha SAI

Kha BUNG

SAI

BUNG RAt BUNG

RAtSAI

Hoan toan BUNG

Hoan tofm SAI

-

0

x

1

0

mnh 2.3. Bi~n ngon ngu "BUNG" dinh nghla b6'iBaldwin Cae lu~t suy di~n: (A A (A => B» => B

(modus pollens)

(BA(A

(modus tollens)

~ B))~

A

«A => B) A (B => C» => (A => C)

(2.23)

(tam do~ lu~)

GQiyeA) va v(B) la cae chan tri ngon ngu cua m~nh d~ A va B, bi€u di~n du6'idl;tng: yea) = aI/vI + az/vz + ... + an/vn v(b) = ~l/WI + z/wz + ... + ~m/wm v6'i aj, ~j, Vi,Wi E [0, 1]

Taco: ,

V

(NOT A) == 1 -

V

(A) = al/(I-vI) + az/(l-vz) + ... + an/(l-vn)

v (A AND B) ==yeA) A v(B) = Lmin(ai'p)/min(vj' ij

v (A OR B)

==yeA)

v v(B) = Lmin(aj,p)/max(vi' ij

w) w)

(2.24) (2.25) (2.26)

18

v (A => B) ==v(A) => v(B) = Imin(a;,f3)/max{1-vpmin(vp ij

w)} (2.27)

Ngoeii(2.27), con c6 nhi~u dinh nghla khac cua phep keGtheo c6 th€ dung d€tinhv(A=>B). 2.3. L~p lu~n xfip xi: X, Y, z: bi~n ma, nh~n gia tIt trong t~p vil tn,1D, V, W A, B, c: vi tu ma - Lu~t chi~u (Projection rule of inference): N~u (X, Y) leiR thi X lei[R-1-X]

(2.28)

v6'i [R-1X] leiphep chi~u cua quail h~ ma R len X. - Lu~t giao / rieng bi~t h6a (Conjunction / Particularization rule): N~u X leiA veiX leiB thi X leiA n B

(2.29)

N~u (X, Y) leiA veiX leiB thi (X, Y) leiAn (BxV) N~u (X, Y) leiA vei(Y, Z) leiB thi (X, Y, Z) = (AxW) n (D x B)

(2.30)

- Lu~t tach rai (Disjunction / Cartesian product rule): N~u X leiA ho~c X leiB thi X leiA u B

(2.31)

N~u X leiA, Y leiB thi (X, Y) leiA x B

- Lu~t phu

dinh (Negation rule):

N~u NOT(X leiA) thi X lei A

(2.32)

- Lu~t k~ thua thu tv (Entailment rule ofinferrence): N~u X leiA veiA c B thi X leiB

(2.33)

- Lu~t k~t hgp (Conpositional rule of inference): N~u X leiA vei(X, Y) leiR thi Y leiA

0

R

(2.34)

19

v6i A

0

R chi k~t hqp fiax - mill cua t~p fib' A va quail h~ fib' R, dinh

nghia nhu sau:

(2.35)

fl AoR(V) = maxmin(uA(u),I1R(u,v)) u

- Modus pOllens tfmg quat:

N~u X la A va

(2.36)

N~u X la B thi Y la C Thi Y la A o(B EBC) (2.37)

v6i I1s(JJc(u, v) = min(l,l-I1B(u) +l1c(v))

- Nguyen ly fia rQng(Extension principle): N~u X la A thi reX) la reA) ..

(2.38) ,

?

3. Hf lJieu khien / Quyet iljnh mil (Fuzzy logic Control / DecisionSystem):

x

r-------------------

BQ Mb'hoa

fleX)

iI

FY Qng ca

I

1 fl(Y) I I I I

suy di€n

BQ khu Mb'

, I I I I I I I I I I I

Casa lu~t I:

I I I I I I I I

fib' J

mnh 2.4. H~ quy~t dinh dung logic fib'

y

20

Trang h~ th6ng tren, v6i cac gia tri dfiuvao x, h~ IDase cho k~t qua dfiura y. N~u y la IDe>thanh de>ngdi~u khi~n cho IDe>tthi~t bi, thi h~ th6ng tren la h~ di~u khi~nIDa.Con khong, d6 la h~ quy~t dinh IDa [9]. Be>IDa h6a (Fuzzifier) chuy~n cac du li~u duQ'cdo luang ra thanh cac gia tri ngon ngu thich hQ'P.CO'sa lu~t IDa(Fuzzy rule base) gift nhung tri thuc v~n hanh ti~n trinh cua cac chuyen gia trang lInh Vl,lCd6. De>ngcO' suy diSn (Inference Engine) la c6t lai cua h~ th6ng. N6 c6 kha nang IDaphong vi~c ra quy~t dinh cua con nguai b~ng cach l~p lu~n xApxi, d~ tITd6, d~t duQ'cchi~n luQ'cdi~u khi~n IDong mu6n.Be>khl'rIDa (Defuzzifier) se sinh ra cac quy~t dinh ho~c cac di~u khi~n "ra" tit k~tqua IDacling cApbai de>ngcO'suy diSn. 3.1. CO' sO' lu~t miY: Cac lu~t IDa trang h~ th6ng duQ'c bi~u diSn du6i d~ng:

R!:NED x la Ai, ... AND Yla Bi THI z=Ci (i=l, 2, ..., n)

(2.39)

v6i x, y, z la cac bi~n ngon ngu IData tr~ng thai cua h~ th6ng va A, B, C la caegia tri ngon ngu tuO'ngung. Me>tcach vi~t khac cua lu~t IDa: R!:NED x la Ai, ..., AND Yla Bi THI z = fi(x, ..., y)

(2.40)

v6'i f leihaID cua cac bi~n IDa ta tr~ng thai h~ th6ng. 3.2. DQng CO'sur di~n: Ap d\lng l~p lu~n IDa vao h~ th6ng, qui t~c IDodus pOllens tbng quat c6 th~ vi~t l~i nhu sail:

Gia thi~t 1: NED x la A THI y la B

(2.41)

Gia thi~t 2: x la A' K~t lu~n: y leiB' GQi quail h~ IDa Ria quail h~ d~ diSn ta phep keo theo R = A -7 B. Ta c6:

21

B' = A'

0

R = A' 0 (A

-7 B)

(2.42)

Trong do, 0 la phep toan theo cong thuc (2.35). Phep keo theo ma theo dinh nghia cua Mamdani co ham thanh vien nhu sau: Rc:a -7 b = a /\ b

(2.43)

flA-7B(u,v) = flA (u) /\ JlB (v)

Thi dl} minh hQa: Cho mQt h~ lu~t g6m 2Iu~t. D~u vao la 2 bi~n Xl va X2. D~u ra la y.

NEDxlla Alkva x21aA/ THIlla Bk ,u(XI)= 5(Xl - input(i)) =

I, { 0,

,u(X2)= 5(X2 - input(j)) =

XI = input(i) nguoclai

I,

X2 = input(j)

{ 0,

nguoclai

,uBk(Y) = m:x[ min[,u Af (input(i))"u

A~(input(j))]]

(2.44 )

(2.45) (2.46)

22

I I

: InputU)

I I I I I !

A21

I

B2

A22

mIll

Input(i)

InputU)

mnh 2.5. Phuong phap suy di~n Mamdani vai dAtivao rD. 3.3. Khif mo-: *

,

GQiz la gia tri cua z sail khi khu mer.C6 nhieu phuong phap khu merkhac nhau[15]:

-Nguyen ly thanh vien Ian nh~t (Max -

membership principle):

*

/lcCz) ~ /lc (z),

vai mQi z E Z

(2.47)

- PhuO'llgphap Centroid: z * = f,ue (z)

. zdz

f,ue (z)dz

- PhuO'llgphap trung binh trQng s6 (Weighted average method):

(2.48)

23

z' = Lflc(~). ~ Lflc(z)

(2.49)

Phuang phap miy giai h~n cho cae ham thanh vien co d~g d6i Xlmg,trong do z hi gia trt z trung binh cua t~p ma. Jl 1 0.9

0.4

a

b

z

IDnh 2.6. Phuang phap khir ma trung binh trQngs6

.

z = a(0.5) + b(0.9) 0.5+0.9

24

II. M~NG NORON (NEURAL NETWORK): M~ng naron nhan t~o la h~ th6ng duqc xay dvng nh~m dua vao su d\mg m<)tsf>nguyen 1;'t6 chuc tuang 1\1'nhu cua b<)nao con nguai trong xu 1;'thong tin. M~ngnaron hua h~n san sinh ra m<)tth€ h~ mai cua cac h~ th6ng xu 1;'thong tin. M~ngnaron nhan t~o lIng d\mg t6t trong cac Hnh vvc, nhu: d6i sanh va phan lap mfiu,xfipxi ham, t6i Uti,luqng tu hoa vector, gom c\lm du li~u... M~ng naron g6m m<)ts6 luqng 100 cac dan vi xu 1;'k€t n6i vai nhau ho~t d<)ngsong song va cfiu hinh nen ki€n truc cua h~ th6ng. Do mo ph6ng cach thuc ho~td<)ngcua cac naron th~n kinh, nen m~ng naron co kha nang hQc,tMt~o va t6ng quathoa tir du li~u da duqc hufin luy~n. Trong ph~n nay, chi xin trinh bay cac vfin dS cua m~ng naron vai thu~t giai IantruySnnguqc d~ xay dvng mo hinh phi tuy€n tren t~p du li~u.

1. Kiin true m(lng nO'ron va CO'chi ho{lt il{Jng [5J: Dan vi t~o nen m~ng naron la cae nut. Cae nut nay se n~m (] eae lap (layer) khaenhau. M6i lap eo m<)tnhi~m V\lrieng:

- Lap nh~p (input layer): nh~n du li~u d~u vao. Cae nut thu<)elap nh~p gQi la nut nh~p.

- Lap xufit (output layer): k€t xufit du li~u. Cae nut thu<)clap xufit gQi la nutxuk - Lap ~n (hidden layer): lap nay eo th~ eo ho~e khong, tuy lo~i m~ng. S6 luQ'Ilg lap ~n eua m<)tm~ng naron eling tuy theo nguai thi€t k€ m~ng. Cae nut thu<)e lap ~ngQila nut ~n.

25

Lap nh~p

Lap An

Lap xu.1t

mnh 2. 7.M~ng TImon3 lap M6i nut trong lap nh~p nh~n gia tri cua biSn dQcl~p va chuy~n VaGm~ng. Cacnut trong lap Annh~n du li~u tir nut nh~p, "t6ng trQnghoa", chuy~ntin hi~u cho lap xuc1t.Cac nut t~i lap xu.1tcling t6ng trQnghoa tin hi~u nh~n tir lap An.M6i nut trong lap xu.1ttuO'ngung vai mQt biSn ph\! thuQc. M6i cling lien kSt trong m~ng norond€u co mQttrQngs6 rieng cua minh. s6 luQ'ngbiSn dQc l~p, biSn ph\! thuQc ma m~ng TImoncho phep la tliy y. £>6ngthai, m~ng TImonlam vi~c duQ'ctren ca biSn dinh luQ'llgl~n cac biSn lap. Truac tien, gia tri cua biSn dQc l~p duQ'cchuy~n cho lap nh~p cua m~ng. T~icac nut nh~p kh6ng co xu ly naG, ma no chuy~n gia tri cua no cho cac nut An. M6i nut Antinh t6ng trQng hoa cua t.1tca du li~u nh~p b~ng cach cQng d6n t.1tca tichgiua gia tri nut Anvai trQng s6 cling lien kSt giua no vai nut nh~p. KS tiSp, mQt hamtruy€n duQ'cap d\!ng tren t6ng trQnghoa nay cling vai mQtnguang cua nut An do, cho ra gia tri th\fc cua nut An. (Ham truy€n la nen gia tri VaGmQt mi€n giai h~n.).No gui gia trt nay cho nut xu.1t.M6i nut xu.1tcling th\fc hi~n thao tac tuang t\f nhunut An,cho ra gia tri kSt xu.1tcua nut xu.1t.Gia tri cua cac nut xuc1tla gia tri cua cac biSn ph\! thuQc c~n xac dinh. M~ng nO'ronho~t dQng a hai tr~ng thai:

26

- HQc. - Anhx~. Trongtr~ngthai hQc,t~pdu li~umfiudua vao m~g baa g6m ca ghitri dAu vao lfingia tri k~t xuAtcua cac bi~n ph\! thuQc.Thong tin nh~p duQ'cdua vao m~ng. Cac du li~u duQ'ctinh toan va cho ra k~t qua xuAt.K~t qua xuAtnay cua m~ng duQ'c so scinhv6'i k~t xuAtthlJc duQ'ccho trong t~p mfiu d~ rut ra sai s6. Sai s6 nay duQ'c Iantruy~nnguQ'ctra l~i cac nut xuAt,nut ~n, d~ cac nut nay di~u chinh l~i cac trQng s6 cua minh. Qua trinh Ian truy~n theo hai chi~u nay duQ'cti~n hanh nhi~u lAn,cho d~nkhi sai s6 chApnh~n duQ'c:nghia la trQngs6 cac nut trong m~ng da dung: m~ng duQ'cluy~nxong. Khi m~ng da duQ'cluy~n xong, thi nguai ta co th~ dung m~g cho cac m\!c dich cua minh. Nghia la bay gia, dua du li~u cac bi~n dQc l~p vao m~ng, m~ng se chogia tri cac bi~n ph\! thuQccAnxac dinh.

2. cau true va ho{lt il{jngeua nut an, nut xuat va m{lng ndron [5J: 2.1.Ham truy~n:

/" /...

,.

,.

,.

,.

,.

,.

,.

,.

,.

,.

,.

,.

,.

,.

,.

,.

,.

,

-,' ,.

IDnh 2.8. D6 thi ham truy~n d~g S MQtham s(u) la mQtham truy~n d~ng S n~u thoa: -

s(u) la ham bi ch~n.

27

- s(u) la ham dan di~u tang. -

s(u) la ham lien t\lCva tran.

MQi ham thoa 3 tlOO chAt tren d€u co th€ sir d\lng lam ham truy€n trong

m~ng. Trong th\Ic t~, ham logistic g(u) thuang duQ'csir d\lng rQngrai. 1 g(u)

(2.50)

=~

1+-;;e Ch~n tren

0

Ch~n du6i

Hinh 2.9. Ham logistic 2.2. Nut in:

al

Xl I

II

GJ u=ao+ L ajxj

Xn

I

an

y=g(u)

Hinh 2.10. Nut Annh~n n gia tri OO~p Xt,

,Xj, ""xn:giatrinnutOO~p.

)

....

y

28

a),

, aj, ..., an:tn;mgs6 cling lien k€t nut nh~p i va nut Andang xet.

ao: trQng nguang nut An

u: t6ng tn;mgh6a cua nut Andang xet. n

U

= ao + I;=\ aix;

(2.51)

y=g(u): t6ng trQng h6a duQ'cnen b~ng ham truy€n: la k€t xuftt cua nut An. 2.3. Nut xuAt:

YI

.1

bI

I( v=bo +

,

.m

Ym

1\

I

bjYj

\

z

z=g(v)

IDnh 2.11. Nut xufttnh~ tin hi~u cua m nut An y),

, Yj,..., Ym:gia trj k€t xuftt cua m nut An.

b),. ..., bj, ..., bm:trQngs6 cling lien k€t nut Anj va nut xuftt dang xet. bo:trQngnguang nut xuftt v: t6ng trQngh6a cua nut xufttdang xet. z=g(v): t6ng trQng h6a duQ'cnen b~ng ham truy€n: la k€t xuftt cua nut xuftt. m

(2.52)

V = bo + IbjYj j=\

2.4. M~Dg Do-rOD:

Cho mQt m~ng naron 3 lap

- 1 lap

An.GQi:

29

I: s6 nut nh~p cua m~ng. H: s6 nut Ancua m~ng. 0: s6 nut xu~t cua m~ng. K~t xuAt cua nut Anj G=l..H) du<JctiOO:

" 1

U

J

= aoJ + ~ ax .

I)

(2.53)

I

i=1

Yj= g(Uj)

K~t xuAtcua nut xuAtk trong m~ng co 0 nut xuAt:(k=1..0) H Vk

= bOk

(2.54)

+ IbjkYj j=1

Zk

= g(Vk) ,

,

3. Lan truyen ngU'(1csai so- PhU'ung phtip giiim gradient [5J 3.1. M~t l&i:

HQc la qua trinh tim cac trQng s6 cua m~ng saDcho anh x~ cua m~ng kh6p nhAtv6i be>du li~u chua cac mfiucua ham dich. Sai s6 trung binh binh phuO'ng E thuang du<Jc sir d\mg d€ do luang SlJ trimg kh6p giua aOOx~ cfin xiiy dlJilg v6i ham dich cho tru6c (thong qua t~p mfiu).

GQi: K: s6 bi~n ph\! thue>c

N: kich thu6c t~p mfiu Zkn:k~t xuAtcua nut k cua m~ng v6i mfiun (k=1..K) (n=1..N) tkn:k~t xuAt dung theo t~p mfiu Thi: sai s6 trung binh binh phuO'ng tren toan be>t~p mfiu

30

1 E =

N

K

2 LL(Zfm n=lk=l

-tfm)2

N.K

(2.55)

v~ m~t hinh hQc,co th~ xem E nhu mQtm~t 16i.M~t 16ila mQtsieu ph~ng trong do m6i di~m cua no tuang ung v6i mQtdi~m trong khong gian trQngs6. Chi~u caDtren khong gian trQng s6 cua m6i di~m trong m~t 16ibi~u di~n sai s6 cua mo hinh ung v6i cac trQngtuang ung do. f)i~m thfip nhfit tren m~t 16icho ta mo hinh co sai s6 it nhfit. 3.2. PhU'O'ng phap ghim gradient:

G6m cac bu6c chinh sail: BU'O'c1: chQn ng~u nhien mQt di~m xo trong khong gian trQng s6. BU'O'c2: Tinh dQa6c cua m~t 16it~i xo. BU'O'c3: c~p nh~t cac trQng s6 theo hu6ng d6c nhfit cua m~t 16i. BU'O'c4: xem di~m nay nhu di~m Xom6i

L~p l~i bu6c 2 d~n bu6c 4 thi d~n mQt Ilk nao do, cac gia tri cua bQtrQng s6 se ti~p c~n duQ'cdi~m thfipnhfit trong m~t 16i. Khong th~ tinh toan duQ'cd~ng cua toan m~t 16i.Nhung co th~ tinh duQ'c chi~u caDva dQ d6c m~t 16it~i bfit kYdi~m nao trong khong gian trQng.Trong toan hQc,dQ d6c m~t 16i duQ'cxac dinh b~ng d~o ham rieng theo tUng trQng s6 trong m~ng naron. Khi da:bi~t duQ'c dQ d6c cua m~t 16i, se sir d\mg thong tin nay b~ng cac qui t~c hQc d~ c~p nh~t bQtrQng s6. Ph~n 3.3 se trinh bay v~ d~o ham rieng theo cac trQng s6 cua m~ng naron. Khi da: co d~o ham rieng, nghla la da:bi~t dQ d6c m~t 16i, ph~n 3.4 se trinh bay qui t~c hQc thich nghi d~ c~p nh~t bQtrQng s6 cua m~ng.

31

3.3. B~o ham rieng tU'O'ng«ng vOi cae trQng s6: 3.3.1. TrQng s6 nut xuit: Xet 1 nut xu~t.

illnh 2.12. Nut xu~t va cac tn;mg s5 cua no. G<;>i:

z: k~t xu~t thlJc cua nut xu~t (theo (2.54)).

t: k~t xu~t dung cua nut (2.56)

p=(z-t)z(l-z) bj: cac tr<;>ngs5 cua nut xu~t G=O..H) H: s5 nut An

Yj:k~t xu~t cua nut tlnj G=I..H) D~o ham rieng tuang lmg v6i cac tr<;>ng s5 la: BE

P

,j =0

Bbj = { PYj ,j:5, H

(2.57)

32

3.3.2. TrQng sA nut An: Xct 1 nut An.

~ u=ao+ L

ajXj

y=g(u)

IDnh 2.13. Nut Anva cac trQngs6 cua no. GQi:

q =(~Pkbk }(1- y)

(2.58)

v6i p theo (2.56) 0: s6 nut xufit cua m(;lng. I: s6 nut nh~p cua m(;lng D(;loham rieng tuang (mg v6i cac trQng s6 Ia:

BE

q ,i = 0 Ba; = { qx; ,i ~ I

(2.59)

3.4. Cac qui t~c hQc: Sau khi da tinh duQ'cde>d6c m~t I6i, ta sir d\lng cac k€t qua cua (2.57) va (2.59)theo nhi~u cach khac nhau d~ c~p nh~t be>trQngs6 cho m(;lng. 3.4.1. Qui t~c delta:

33

Qui t~c hQc delta la m(>ttrong nhung qui t~c nguyen thuy nh~t cua Ian truy€n nguQ'c.Theo do, cac trQng s6 se duQ'cc~p nh~t sao cho hu6ng ma ham 16iE 1\1txu6ng se d6c nhfit. GQi: Wm:trQng s6 cAn c~p nh~t (Ia aij d6i v6'i nut An, bjk d6i v6'i nut xu~t) t~i bu6'c thu m. dm: d(>l6n cua vectO'tfmg cac vectO' d~o ham rieng ham 16i.

N: kich thu6'c t~p m~u N

BE

(2.60)

d -2:m

- n=1( 8\vm ) n

Thi: Wm = Wm-l

+ Cm

(2.61)

cm = - E dm

(2.62)

Trong do:

E: tham s6 hQc (learning rate parameter): do ngmJi dung quy€t dinh,

:

I ~

I

,

,

thuemgduQ'cchQntheo phuO'ngphap thu-va-sai. Day la h~n che cua qui Hicdelta. ,

,

cm:bien thien trQng so W &bu6'c m

3.4.2. Qui t~c mo men: La m(>tcM ti€n cua qui t~c delta. Theo do, gia tri cua E se thay d6i thich hgpv6'itung bu6'c hQc. Nghia la: n€u cac bu6'c hQc trn6'c dang giam m~nh thi theo da - bu6'c t6'i cling se giam m~nh -+ tang h~ s6 hQc E d€ bi€n thien trQng Cmtang len - va nguQ'c

l~i. Khi do, bi€n thien trQng duQ'ctinh: cm = ~ Cm-l + (1-~) E dm

(0:::;~ < 1)

(2.63)

34

3.4.3. Qui t~c hQc thich nghi: Con duQ'c gQi 1<\phuO'ng philp delta - bar- delta, 1<\phuO'llg philp cai ti€n duQ'cxem 1<\hi~u qua ooAt cua phuO'llg philp delta.

Y tu&ng cua phuO'llg philp 1<\:m6i trQng sf>w se co m(>ttham

sf>hQc e khac

OOau.Khi c~p nh~t trQng sf>,n€u hu6'ng giam 16i hi~n h<\OOcling hu6'ng v6i bu6c tru6c, e 16'n,con n€u nguQ'c hu6'ng, e se 006. Hu6'ng giam 16i duQ'c xac dinh b6'i dAti cua dm (2.60). N€u dm duO'llg, 16i giam khi trQng sf>giam. N€u dmam, 16i giam khi trQng tang. PhuO'llg philp hQc thich nghi v~n d\mg khai ni~m hu6'ng 16i "vira m6i" giam OOusau: fm+)

= e fm+ (1- e) dm (0:::;e < 1)

(2.64)

Tham sf>echo bi€t "khoang thai gian m6i day" 1<\bao lau. Khi do, h~ sf>hQc thich nghi e tiOOtheo cong thuc:

=

e m

em-I

+K

{ em-l x rjJ

,

d nfm > 0

,

dmfm ~ 0

(2.65)

Trong do: K, : tham sf> thu(>c (0, 1)

Khi da:co emthi bi€n thien trQng trong (2.63) tiOOl~i theo cong thuc: cm = ~ cm-) - (1-~t) em dm

(2.66)

35

3.5. Thu~t toaD hQcIan truy~n ngtfClc(Back-propagation Learning Rule) Algorithm BackPropagation DAuvela:

T~pm~u luy~nv6i N m~u. ciiu hinh m~ng: m nut nh~p, n nut xuiit. sf>lap ~n: Q. GQi: qYi: k€t xuiit cua nut thu i trong lap q.

KhOi t~o: -

H~ sf>hQce (theo qui t~c delta - bar - delta). Emax(nguang 16i - max tolerable error).

E=O k=l (k=I..N: chi sf>d~ duy~t h€t t~p m~u). BU'Cyc 1: L~p v6i m~u k

+ q=l (lap nh~p) + X;(k):gia tri nh~p cua nut nh~p i (i=1..m) cua m~u k. + Truy€n diJ li~u nh~p cua m~u thu k VelOlap nh~p QYi= IYi =

x?) cho tiit ca cac nut i thuQclap q

+ dY) : k€t xuiit dung cua nut xuiitj cua mdu k

36

Bmyc 2: Lan truy~n ti~n

q=2 L~p v6i q<=Q L~p cho tUng nut i cua lOpq QYi=

t6ng trQnghoa cho nut thu i cua lOpq

(K~t qua cua bu6c llC1Y la n k~t xuAt cua n nut xuAt) B1ftYC3: Tinh sai s6 k~t xuAt

E =~ tcdY)_Qy)2 +E 2 j=l

Tinh sai s6 theo d~o ham rieng cac trQngs6 theo cong thuc (2.57) va (2.59) va cac cong thuc (2.56), (2.58). Bmyc 4: Lan truy~n nguQ'c sai s6 Tinh bi~n thien cac trQng s6 va cac h~ s6 lien quail theo cac cong thuc tuong lIng tIT(2.60) d~n (2.66) (tuy phuong phap hQc C\lth€ chQn).

Bmyc5: Quay l~i bu6c 11~p cho mdu k~ ti~p. Sang Bu6c 6 khi k>N. Bmyc6: N~u E<Emaxthi dUng (ho~c ap d\lng cac qui t~c ki€m tra cheo d€ dUng ti~n trinh luy~n) NguQ'c l~i thi: C~p nh~t cac trQng s6 theo cac bi~n thien trQng co trong Bmyc 4.

E=O. k=1. Quay l~i Bmyc 1. End BackPropagation

37

Thu~t tmin BackPropagation tren day c~p nh~t trQng s6 khi da:duy~t qua h~t t~p mati (chu khong phai qua tung mati). Cac bu6c va cong thuc trinh bay da: duQ'cchQnlQCphil hgp v6i mo hinh se xay d\lng sau nay.

---000--Tren day vua trinh bay m<)ts6 vftn d~ v~ h~ ma va mc;tngnaron, t~p trung vao nhftng chi ti~t se sir d\lng trong mo hinh sau nay. Trong chuang 3 va chuang 4, khi xay d\lng va thi~t k~ mo hinh, cac vftn de lien quail d~n thi~t k~ rieng cua mo hinh se duQ'ctrinh bay C\lth~.

Related Documents