You are on page 1of 14

HNG DN S DNG PHN MM MNG T T CHC SPICE-SOM

Cao Thng 2003 2007

Cp nht 2011 Jan.

Neuron j


OUTPUT LAYER

W ij

Neuron 1

W i1
INPUT LAYER

x1

xi

xn

1. GII THIU Mc ch chnh ca ti liu ny l hng dn bn c s dng phn mm Spice-SOM mt phn mm mng t t chc SelfOrganizing Map (SOM) hay cn gi l mng Kohonen. Nu mun tm hiu k v l thuyt, cc bn c th tham kho cc ti liu v mng n ron, SOM, c sn trn internet hoc sch chuyn ngnh. Ty thuc vo phin bn Spice-SOM m bn ang s dng, mt s hng dn hoc giao din minh ha trong ti liu ny c th khc vi thc t. Mc ch ca cc phn mm Spice-Neuro v Spice-SOM l gip bn bit cch s dng mng n ron mt cch c bn, nhanh chng v hiu qu m khng phi c nhiu v l thuyt mng n ron. Khi bn hiu r tng chc nng ca cc phm mm ny, bn c th d dng tip cn vi l thuyt cng nh cc ti liu tham kho v mng n ron.

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 1

Spice-SOM c vit vi mc ch hng dn sinh vin v nghin cu sinh hc tp v s dng SOM m hnh ha nhiu loi d liu khc nhau. Hin ti Spice-SOM ang c nhiu bn trn th gii s dng. Spice-SOM c giao din vi ting Vit, ting Anh v ting Nht. Spice-SOM c vit bi CAO THANG khi tc gi lm vic ti Soft Intelligence Laboratory, Ritsumeikan University, Japan, 2003-2007 Spice-SOM v Spice-Neuro c th download c ti: http://www.spice.ci.ritsumei.ac.jp/~thangc/programs/ hiu hn v mng n ron vi cc ng dng nh nhn dng khun mt, ngi i b, d bo chng khon..., cc bn nn c thm ti liu Mt s v d phn loi dng SOM v MLP Neural Network (neural_network_practical_use.pdf). Tc gi hi nh thng c truyn c tch, bn c th enjoy truyn c tch cng tm s ca tc gi ti http://www.spice.ci.ritsumei.ac.jp/~thangc/vuoncotich/index.htm Nu c thc mc hoc cn thm cc chc nng ca Spice-SOM, bn c th lin h vi tc gi ti thangc@spice.ci.ritsumei.ac.jp hoc thawngc AT gmail DOT com. Cm n cc bn.

2. CI T SPICE-SOM Download file ci t ca Spice-SOM, chy Setup.exe v theo cc ch dn trn mn hnh, trn mn hnh hin ra:

Hnh 1. Ci t

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 2

Chn Next, sau bn chn th mc m bn mun ci t Spice-SOM vo, sau chn Next v Next tip. Spice-SOM s c ci vo th mc bn chn.

Hnh 2. Chn Folder ci vo

Lu : Nu sau khi ci t, chng trnh khng chy, c th bn cn ci Microsoft .NET Framework Redistributable Package 3.5.21022 trc khi ci Spice-SOM.

3. S DNG SPICE-SOM Chy Spice-SOM bng cch click vo biu tng Spice-SOM trn desktop hoc trong Start Programs Cao Thangs Spice-SOM Spice-SOM.

Trn mn hnh hin ra giao din ting Anh, bn c th chn ngn ng ting Vit hoc ting Nht bng cch chn Options Languages.

Hnh 3. Chn ngn ng

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 3

Trong cc giao din minh ha di y, ngn ng c s dng l ting Vit. Menu V chng trnh. Hy c trc khi s dng l gii thiu vn tt v Spice-SOM v s ng ca ngi s dng. Bn cn c k trc khi s dng Spice-SOM.

Hnh 4. V chng trnh

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 4

3.1. Chun b d liu

Spice-SOM c c d liu ca bn, bn cn chun b d liu ca mnh theo chun sau: D liu cn c chun b dng file text vi cc hng v ct. u tin l ID, sau l d liu vo v sau cng l nhn (label). Cc gi tr c phn cch bng du phy vi file CSV (Comma Separated Value File Format) hoc du Tab vi file TXT (Tab Separated Value File Format). Bn c th dng MS Excel bin son d liu, sau lu vo file file text hoc file csv. V d d liu vi 5 u vo, 4 dataset c t chc nh bng 1.
Bng 1. D liu text vi 5 u vo, 4 dataset

ID 0 1 2 3

X1 0 0 1 1

X2 0 1 0 1

X3 0 1 1 0

X4 0 0 0 1

X5 0 1 1 1

LABEL Data 1 Data 2 Data 3 Data 4

ID: th t DataSet

X: D liu vo

LABEL: Nhn ca tng DataSet

Lu : D liu phi l dng s (ngoi tr nhn (label) v cc k hiu u vo, u ra). Nu c d liu trng hoc null, Spice-SOM s khng c c. Mt s v d v d liu c t trong th mc \Data ca Spice-SOM: number5group1dimension l v d vi 100 datasets, 1 input. number5group2dimension l v d vi 100 datasets, 2 inputs. number5group3dimension l v d vi 100 datasets, 3 inputs.

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 5

3.2. Ti d liu
Gi s chng ta dng d liu l file number5group3dimension.txt, l v d vi 100 datasets, 3 inputs ni trn.

D liu vo (dng bng)

Cc hm chun ha Thanh chn d D liu vo (dng th) liu

Hnh 5. Ti d liu

Trong mc S u vo v D liu, bn chn nh hnh 5. Sau Chn nt Ti t file text, d liu s c ti vo b nh. Trong mc D LIU bn phi, bn c th xem li tng dataset ca d liu m bn va ti. Nu d liu ca bn cha c chun ha, bn c th dng chc nng chun ha d liu vi mt s hm chun ha sn c ca Spice-SOM. Trong phn Ti d liu trnh by trn, bn c th xem li tng dataset ca d liu m bn va ti. Trong Tab Xem d liu bn c th xem th ca ton b d liu nu s lng d liu khng ln nh c minh ha trn hnh 6.

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 6

Hnh 6. Xem d liu vo

3.3. o to mng

Hnh 7. Chn d liu hc v cc tham s

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 7

3.3.1. Chn cc tham s Trc khi o to mng SOM, bn cn chn cc tham s cho mng. Giao din o to mng c minh ha trn hnh 7. Sau y l cc tham s: 1. Sigma Max: Bn knh ln nht ca hm ln cn (neighborhood function) ca winner neuron. 2. Sigma Min: Bn knh nh nht ca hm ln cn ca winner neuron. 3. Sigma Decreasing Rate: T l gim ca bn knh hm ln cn qua mi ln lp 4. Learning Rate Max: T l hc ln nht 5. Learning Rate Min: T l hc nh nht 6. Iterations: S ln lp 7. Inhibition: Gi tr inhibition ca hm ln cn trong trng hp hm Mexican Hat 8. S X Neurons: S n ron theo trc nm ngang 9. S Y Neurons: S n ron theo trc thng ng Nu bn chn Tip tc vi trng s hin ti, mng s hc vi cc trng s hin ti m khng cn phi khi ti li. Nu bn chn Xem th Online, th ca hm ln cn (Neighborhood Function) v th li MSE s hin ra trong qu trnh hc. Tuy nhin mng s hc chm hn do my tnh phi v th cng vi vic hc ca mng. Hm ln cn: bn cn chn hm ln cn (Neighborhood Function). Spice-SOM cung cp cho bn mt s hm chun nh hm ch nht (Rectangular), hm m Gaussian, hm m Mexican v hm tuyn tnh. Chn Topology: mc nh ca chng trnh l Topology hnh ch nht (Rectangular), bn c th chn Topology hnh lc gic (Hexagonal) Checkbox Topo hnh lc gic. Khong cch gia cc n ron ln cn ca hai Topo ny khc nhau nh c minh ha trn hnh 8.
HEXAGONAL: O O O O O O O O O O O O & & & O O O O O & @ @ & O O O O O & @ + @ & O O O O & @ @ & O O O O O O & & & O O O O O O O O O O O O O O O O O O O RECTANGULAR: O O O O O O O O O O & O O O O O & @ & O O O & @ + @ & O O O & @ & O O O O O & O O O O O O O O O O O O O O O O O

Hnh 8. Topology hnh ch nht (Rectangular) v Topology hnh lc gic (Hexagonal)

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 8

3.3.2. o to mng (training) Sau khi chn cc tham s, bn c th bt u o to mng. Sau y l cc nt lnh chnh. Hc: Bt u cho mng hc Lu trng s vo file nh phn: Lu trng s hin ti ca mng vo file nh phn lc khc c th ti li. Lu trng s vo file text: Lu trng s hin ti ca mng vo file text c th kim tra gi tr ca tng nt mng. Ti trng s t file nh phn: Ti trng s lu file nh phn vo mng hin ti. Lu th MSE vo file text: Lu th li m mng va hc xong vo file text. Chn cc gi tr mc nh: Chn cc tham s mc nh ca Spice-SOM

Bng 2 minh ha d liu li c lu vo file text vi nt lnh Lu th MSE vo file text. Bng 3 minh ha trng s cc nt mng lu trong file text.

Bng 2. D liu li MSE

Iteration 0 1 2 3 4 5 95 96 97 98 99

Error 10.02597948 4.14776422 3.42406203 3.378296441 3.256567794 3.209400383 1.018524437 1.011947207 1.007276918 1.002205101 0.998116728

Neighbor Distance 10 9.9 9.8 9.7 9.6 9.5 2 2 2 2 2

Learning Rate 0.0991 0.0982 0.0973 0.0964 0.0955 0.0946 0.0136 0.0127 0.0118 0.0109 0.0100

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 9

Bng 3. Trng s ca mng lu trong file text

Neurons Neuron Y = 0, X = 0: Neuron Y = 0, X = 1: Neuron Y = 0, X = 2: Neuron Y = 0, X = 3:

Input0 36.99527651 36.85168189 36.36203974 35.27379557

Input1 40.76692789 40.01821143 39.09389637 38.58864861

Input2 37.21308 36.97461 36.61739 36.22565

Neuron Y = 19, X = 16: Neuron Y = 19, X = 17: Neuron Y = 19, X = 18: Neuron Y = 19, X = 19:

19.76819369 17.5739719 12.60898022 8.678481001

5.711848278 6.150696979 6.978729306 7.590027624

3.108250741 3.292584748 3.15416311 2.853186784

4. Bn phn b d liu (map)


Sau khi mng hc xong, bn c th xem bn phn b d liu trong Tab nh phn b d liu nh c minh ha trn hnh 9. Trn nh phn b, cc n ron c sp xp thnh hng v ct. Kch chut phi vo v tr ca mt n ron, bn s thy ni dung (d liu ri vo n ron ny) n ron chi tit. Bn cng c th xem khong cch (biu th bng cc ng ni v gi tr khong cch bn cnh) t n ron c chn (bng cch kch chut tri) n cc n ron ln cn. Bn c th hin th mu n ron trng (blank neuron), mu n ron winners, hoc mu khong cch gia cc n ron. Mu khong cch gia hai n ron l gi tr khong cch gia hai n ron , biu th bng mc xm vi gi tr 0 (xa nht) v 255 (gn nht). Mu ca mt n ron ngha l mu khong cch trung bnh t n ron n cc n ron bn cnh. xm gia hai n ron th hin khong cch ca hai n ron . Sau y l cc la chn xem bn phn b d liu. Xem n ron chi tit gc tri di: t v tr n ron chi tit ti gc tri di Xem n ron chi tit gc phi trn: t v tr n ron chi tit ti gc phi trn Gi cc ng ni hin ti: Gi cc ng ni khong cch hin ti trong khi chn xem cc ng t n ron mi Mu khong cch: Chn ngng mc xm cho mu khong cch. ng khong cch: Chn ngng biu th ng khong cch trn nh phn b. T l th: chn t l th trn mn hnh

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 10

La chn cho th ra: cc la chn cho nh phn b. Sau y l cc la chn . o rng nh, cao nh: Kch thc nh phn b m bn mun lu li, dng khi bn mun nh li c nh khi lu. o Dng file nh: Dng nh m bn mun lu, cc la chn l nh JPG, PNG, BMP o In th t Neuron: In th t cc n ron ln nh phn b o Mu Neuron trng: In mu khong cch ca cc n ron trng. o Mu Winner Neuron: In mu khong cch ca cc winner n ron. o Xem khong cch: In mu khong cch gia cc n ron. o Lu vi kch thc ban u: Lu li nh phn b vi kch thc ban u (khng nh li c nh khi lu) o Topo hnh lc gic: chn Topo ca th l hnh lc gic hoc hnh ch nht (mc nh l hnh ch nht).

Chn nt lnh Lu nh th, nh phn b hin ti s c lu li v a cng. Hnh 10 v 11 minh ha mt nh phn b c lu trn a cng. Bn c th xem th phn b d liu di dng bng bng cch chn Tab Bng phn b d liu, nh c minh ha trn hnh 12. Bn cng c th lu li bng ny di dng file text bng cch chn nt lnh Lu bng phn b d liu. Khi o to li mng, bn xem li bng mi bng cch chn nt lnh Xem li bng phn b.

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 11

Chi tit ca n ron c chn

Gi tr khong cch t mt n ron n cc n ron ln cn

Ty chn cho nh phn b

Mc xm trn n ron th hin khong cch n cc n ron bn cnh xm gia hai n ron th hin khong cch ca hai n ron

Cc thanh la chn gi tr cho mu khong cch v ng khong cch

Nt lnh chn lu nh phn b d liu hin ti

Hnh 9. nh phn b d liu sau khi hc

Hnh 10. nh phn b d liu (Topo lc gic) c lu li

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 12

Hnh 11. nh phn b d liu (Topo ch nht) c lu li

Hnh 12. Bng phn b d liu

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 13

5. Kt lun
Ti liu ny hng dn bn s dng phn mm mng t t chc Spice-SOM. Sau khi vn dng, cc bn c th hiu r hn v hot ng ca mng t t chc (Self-Organizing Map). Cng nh Spice-Neuro (phn mm mng n ron a lp), bn c th dng Spice-SOM m hnh ha nhiu loi d liu khc nhau v c th p dng trong cc bi ton thc t nh nhn dng, nhm, clustering, h tr quyt nh .. Tc gi hy vng Spice-SOM gip ch cho vic nghin cu v hc tp ca cc bn. Sau khi c ti liu ny, cc bn c th tm c ti liu neural_network_practical_use.pdf (download ti cng a ch http://www.spice.ci.ritsumei.ac.jp/~thangc/programs/), trong c minh ha phn loi nh khun mt, nh ngi i b, nh xe hi, d bo chng khon v mt s v d khc. Xin cm n cc bn c ti liu ny v s dng Spice-SOM. Nu cc bn cn thm cc chc nng ca Spice-SOM, xin hy lin lc vi tc gi ti thangc@spice.ci.ritsumei.ac.jp hoc thawngc AT gmail DOT com. Tc gi rt mong cc kin ng gp ca cc bn.

Hng dn s dng phn mm Self-Organizing Map Spice-SOM 2012-02-07

Trang 14