£)~I HQC QUOC GIA THANH PHO HO CHi MINH TRU'CrNG gAl HOC KHOA HOC TU' NHIEN NGUYEN HA GIANG KHAM PHA LuA T KET HO'P MO' . . vA lrNG DUNG . Chuyen nganh: TIN HQC Ma so: 1.01.10 LuAN VAN THAC sl . . (Chuyen nganh Tin hQc) NGU'O'I HU'O'NG DAN KHOA HQC: TS. LE HoAI BAc Thanh phi> Ho Chi Minh -2004 1 MVC LVC ro, *<>G\ MVC LVC 1 DANH MVC BANG MINH HQA 4 DANH MVC HINH MINH HQA 6 LdI CAM ON 9 PHANMa DAu 10 Chuang 1: TONGQUANKHAMPHADU LIEu , 12 1.1Khalll pha du li~u 12 1.2Cac giai dol,lnchinh trong ti€n trinh kham pha du li~u , 13 1.3 Cac nhi~m v\,lk~am pha du li~u 15 1.4Phuang phap kham pha du li~u""""""""""""""""""""""""""""""""""" 16 1.5Cac lol,lidu li~uduQ'ckham pha 18 1.6Nhung ung d\,lngcua kham pha du li~u 18 1.7Nhung v~n d~quail Himtrong kham pha du li~u 20 1.8T6ng quail cac lu~nvan kham pha du li~u 21 1.9Hu6ng nghien cuu chinh cua lu~nvan 22 Chuang 2: LuAT KET HOP TONG QUAT Md 23 2.1 Gi6i thi~u lu~t k€t hQ'P 23 2.1.1 Dlnh nghla hinh thuc 25 2.1.2 Thu~t toan kham pha lu~t k€t hQ'p """""", 27 2.2 Lu~t k€t hQ'pt6ng quat 28 2.2.1 S" cai ti€n v6i lu~t k~t hQ'Pthong thuOng 29 2.2.2 Dlnh nghla lu~t t6ng quat 32 2.2.3 Thu~t loan 33 2.3 Lu~t k€t hQ'ps6 luQ'ng 35 2.3.1 Phuang phap xu Iy thuQc tinh s61uQ'ng 36 2.3.2 Bjnh nghla hinh thuc va thu~ttoan kham pha 39 2 2.4 Lu~t k~thqp t6ng quat ma 41 2.4.1 VAnd~ cua cach xu ly phan gia tri s6 hrQ11gVaGcac khoi'mg 43 2.4.2 Su d\lng t~p ma d~fai f~Choa gia tri s6 luQ'ng 47 2.4.3 Ap d\lng ly thuy~t t~p ma trong vi~c Imampha lu~t k~thqp 49 2.4.4 Dinh nghia lu~tk~thqp t6ng quat ma va cac de>do 56 2.4.5 M6 hinh giai quy~t vAnd~ 61 Chuang 3: THUAT ToAN KHAM PHA LuAT KET HOP TONG QuAT MO 66 3.1 Thu~t toan AFAR 66 3.2 Thu~t toan EFAR 69 3.2.1 Cay ti~n t6 cac item ma (FIP) 70 3.2.2 Xay d\l'ng cay FIP 71 3.2.3 Thu~t toan EFAR 74 3.3 K~t qua th\l'Cnghi~m chuang trinh cai d~t 77 3.3.1 Th\l'c nghi~m so sanh t6c de> 78 3.3.2 Th\l'c nghi~m v~ k~t qua Imam pha 82 Chuang 4: KHAM PHA LuAT KET HOP MO TANG CVONG 85 4.1 Kham pha diI li~utang cuang 85 4.2 Kham pha lu~tk~t hqp tang cuang 86 4.3 Xay d\l'ngthu~troan kham pha lu~tk~thQ'pma tang cuang 89 4.3.1 Cac tinh hu6ng c~p nh~titemset 90 4.3.2 Ap d\lng cay ti~nt6 cac itemset d~Imampha tang cuang 92 4.3.3 Thu~t toan kham pha lu~tk~thqp ma tang cuang 96 4.4 K~t qua th\l'Cnghi~m 100 Chuang 5: lrNG D1)NGKHAM PHA LuAT KET HOP MO " 102 5.1 Kham pha lu~t trong giao tac sieu thi 102 5.2 Kham pha lu~ttrong ca sa diI li~uKDD-CUP-98 108 5.3 Kham pha lu~ttrong diI li~ub~nh nhan Hemophilia 115 5.4 Kham pha lu~t trong diIli~uti~u duang cua v~t nu6i 120 3 Chuang 6: CHUaNG TRINH CAI BAT 122 6.1 M6i truang ling d\lng 122 6.2 Chuang trinh FARMiner 122 6.3 Chuang trinh IncFARMiner 126 KET LuAN vA Hu6NG PHAT TRIEN 131 K€t lu~n 131 Huang phat tri~n 132 TAl LI$U THAM KHAo 133 roe*eoG\ 4 DANH M1JCBANG MINH HQA ro, ~ Bang 2.1: Bang cac giao .tac 24 Bang 2.2: Minh hQadfrli~ugiao tac 28 Bang 2.3: Giao tac minh hQa 28 Bang 2.4: Th6ng ke t~n suit cua man hfmg 29 Bang 2.5: Giao tac ma r(mg 29 Bang 2.6: Th6ng ke t~n suit giao tac ma rQng 29 Bang 2.7: Dfr li~uthong tin ca nhan 36 Bang 2.8: Anh Xc;tsang thuQcHnhnhi phan 37 Bang 2.9: CO'sa dfrli~u giao tac 46 Bang 2.10: ThuQcHnhS6-luQ'ngduQ'cphan lap ma 47 Bang 2.11: Giao tac minh hQa 48 Bang 2.12: Giao tac ma rQngtheo cay phan lap 49 Bang 2.13: Bang sau khi phan lap ma cho dfrli~u 50 Bang 2.14: Th6ng ke s6 d~m cua cac vung ma 51 Bang 2.15: Cac vung ma duQ'cchQnkhi IQcqua nguang minsupp 52 Bang 2.16: Giao tac vai cac vung ma da:duQ'crut gQn 52 Bang 2.17: S6 d~m ma cua (Th\Jcph~m.Cao, Qu~nao.Trung binh). 53 Bang 2.18: Cac itemset co hai ph~n tu 53 Bang 2.19: Cac bQitemset con lc;tisau khi lQcqua nguang. 54 Bang 2.20: BQtin c~y cua cac lu~tk~thqp 55 Bang 2.21: Minh hQath~ hi~n dQccua giao tac trong bang 2.11 57 Bang 3.1: Binh nghla cac ky hi~u duQ'csu d\lng trong AFAR 66 Bang 3.2: Chll'agiao tac da:rut gQnchi g6m cac item ma ph6 bi~n 71 Bang 3.3: Danh sach cac item ma ph6 bi~n 71 Bang 3.4: Danh sach cac itemset ph6 bi~n kham pha tir cay FIP 73 Bang 3.5: Nhfrng ky hi~u duQ'cdung trong thu~t toan EFAR 75 5 Bang 4.1: Cac ky hi~u dung trong thu~t toan tang cucmg 89 Bang 4.2: Giao tac minh hQakham pha tang cucmg 92 Bang 4.3: Cac ky hi~u du<;ycdung trong thu~t tmin IFAR 96 Bang 5.1: MQts6 m~utin trong giao tac dl1li~u 102 Bang 5.2: Danh m\lCmQts6 man hang minh hQa 102 Bang 5.3: MQt s6lu~t di~n hinh du<;yckham pha l06 Bang 5.4: Mo ta thuQc tinh trong bang dl1li~u kham pha 108 Bang 5.5: Danh m\lCcac item t6ng quat trong nhl1ng cfiy phan lap 111 Bang 5.6: Minh ho~ mQt s6 lu~t di~n hinh du<;yckham pha 112 Bang 5.7: Bang thuQc tinh cO'sa dl1li~u b~nh nhan Hemophilia A 116 Bang 5.8: Nhl1ng lu~t di~n hinh du<;yckham pha 118 Bang 5.9: Minh ho~ mQts6 m~utin trong bang dl1li~uti~u duang 120 Bang 5.10: MQts6 lu~t du<;yckham pha tir dl1li~uti~u duang v~t nuoi 120 Bang 6.1: Thong tin chuang trinh cai d~t 122 ~*~ 6 nANH M1)CHiNH MINH HQA ibe*~ Hinh 1.1: Minh hQa cac nnh V\fCduQ'c(rng d\mg kham pha 11 Hinh 1.2: T6ng quail tien trinh kham pha du li~u 13 Hinh 2.1: Minh hQalu~tket hQ'p , 23 Hinh 2.2: Minh hQadQh6 trQ'va dQtin c~y cua lu~tket hqp 25 Hinh 2.3: Minh hQamQtc.1utruc phan lap CCYban 27 Hinh 2.4: Kien truc phan c.1pd€ rai r~c cac thuQctinh s6 luQ'llg 40 Hinh 2.5: Cac khoang rai r~c 43 Hinh 2.6: Cac khoang chia ch6ng cheo 44 Hinh 2.7: Phan khoang d\fatren t~pma 45 Hinh 2.8: Ham thanh vien cho cac vling ma 46 Hinh 2.9: C.1utruc phan lap tren thuQc tinh Mon-hang 49 Hinh 2.10: M6 hinh kham pha lu~tket hQ'pt6ng quat ma 61 Hinh 3.1: M6 hinh thu~t toan AFAR 66 Hinh 3.2: Cay ti~n t6 cac item ma 70 Hinh 3.3: Cay FIP a c.1pth(rnh.1t 71 Hinh 3.4: Cay FIP vai cac itemset (rngvien a C.1pth(r2 72 Hinh 3.5: Cay FIP sail khi b6 cac itemset kh6ng du minsupp 72 Hinh 3.6: Cay FIP vai (rngvien a c.1pth(rba 73 Hinh 3.7: Cay FIP cu6i cling " 73 Hinh 3.8: M6 hinh thu~ttoan kham pha du li~uEFAR 74 Hinh 3.9: Bi€u d6 so sanh thai gian th\fc hi~n cua hai thu~t toan 78 Hinh 3.10: So sanh thai gian theo nguang minconf 79 Bang 3.11: Th6ng ke thai gian th\fc hi~n theo s6 luQ'ngglaD tac 80 Hinh 3.12: Th6ng ke thai gian th\fc hi~n theo s6 vling ma 80 Hinh 3.13: Th6ng ke thai gian th\fc hi~ntheo s6 c.1pphan lap 81 7 Hinh 3.14: Th6ng ke s6 1u~tkham pha theo cac ngu5'ng minsupp 82 Hinh 3.15: Th6ng ke s6 1u~tduQ'ckham pha theo dQtin c~y 82 Hinh 3.16: Th6ng ke s6 1u~tkham pha theo s6 vung ma 83 Hinh 3.17: Quan h~ giua s6lu~t va s6 c~pphan lap 83 Hinh 4.1: Minh hQakham pha du li~uva kham pha du li~utang cuang 85 Hinh 4.2: M6 hinh kham pha lu~tk~thQ'Ptang cuang 87 Hinh 4.3: Tinh hu6ng 1 cho vi~c c~pnh~t itemset ph6 bi~n " 90 Hinh 4.4: Tinh hu6ng 2 c~p nh~t item set ph6 bi~n 90 Hinh 4.5: Tinh hu6ng 3 c~p nh~t itemset ph6 bi~n 91 Hinh 4.6: Cay ti~nt6 itemset ma cho du li~uban dftuDB " 92 Hinh 4.7: Cay ti~n t6 duQ'Cxay dlJng cho du li~uc~pnh~t db+. 93 Hinh 4.8: Cay ti~n t6 cac itemset (rut gQn)cho du li~uc~pnh~t db+ 93 Hinh 4.9: Cay ti~n t6 cho du li~u sail khi c~pnh~t 93 Hinh 4.10: M6 hinh h6a thu~t toaD " 96 Hinh 4.11: So sanh thai glaD thlJc hi~n cua thu~t toaD " 100 Hinh5.1:C~p0 va c~p1cuacayphanlap , 103 Hinh 5.2: C~pthu hai cua nhanh Food 104 Hinh 5.3: C~pthu hai cua nhanh Confection 104 Hinh 5.4: C~pthu hai cua nhanh Beverage 104 Hinh 5.5: C~pthu hai cua nhanh Others 104 Hinh 5.6: Vung ma va ham thanh VieDtuong ling cho cac item 105 Hinh 5.7: Phan lap cho nh6m ki~u nha 110 Hinh 5.8: Phan lap cho nh6m g6c dan 110 Hinh 5.9: Phan lap cho nh6m nghanh ngh~ 110 Hinh 5.10: Phan lap cho nh6m thu nh~p III Hinh 5.11: Phan nh6m cho nh6m phuong ti~n di lam III Hinh 5.12: T~pma va ham thanh VieDd~phan lap 112 Hinh 5.13: C~utruc phan lap cho bang du li~ukham pha 117 Hinh 5.14: T~p ma va ham thanh vien cho thuQctinh Age va Height 117 8 Hinh 5.15: Ham thanh vien cho PVIII, Weight va s61~n chay mall 117 Hinh 5.16: Ham thanh vien cho tu6i, tn;mg luQ'ng, li~u luQ'llg 120 Hinh 6.1: Man hinh chinh chuang trinh PARMiner " 123 Hinh 6.2: Man hinh k~t n6i dfi'li~uva chQnbang kham pha 124 Hinh 6.3: Man hinh khai baa c~vtruc phan lap va vung mO'. ". 124 Hinh 6.4: Man hinh chQnthu~ttoan kham pha. 125 Hinh 6.5: Man hinh xu~t lu~tduQ'ckham pha. 125 Hinh 6.6: Man hinh so sach thai gian thvc hi~n cua hai thu~ttoan 126 Hinh 6.7: Man hinh chinh cua chuang trinh IncPARMiner. 127 Hinh 6.8: Man hinh xem bang giao tac kham pha. 128 Hinh 6.9: Man hinh xem c~utruc phan lap. 128 Hinh 6.10: Man hinh xem cac lu~tduQ'ckham pha. " 129 Hinh 6.11: Man hinh xem t~p itemset ph6 bi~n 129 Hinh 6.12: Man hinh xem itemset thuQcNBd(pDB+). 130 ~.o@ 9 LOI CAM ON ~.~ 2:Jdu tiin toi xin ba!) to [onE} bid o'n j.au j.dc ciin nE}uo'i~hd!) cia tqin tLnh hudnE} ddn toi honE} j.udt qua hi.nh [am [uqin uan, dViu khonE} co j.(i quan tam cUa ~hd!) thi. toi khonE}thi hoan thank [uqin uan na!) ciuC/c,~oi xin ba!) to [onE} bid dn ua j.(i kink h(;mE} citn ~itn ~( Li dtodi :Bdc, ~oi cunEI xin chan thank cdm o'n ciin nhl1nE} E}Lao j.U cia cunEI cdp nhl1nE} kiln thl1c minE} caD ua ci?nh huo'nE} nE}hiin cI1u khoa h9C cho tot: §~,~~!J(dt dtoanE} .!J(r.im, (Pg~,~~ 2:J6n!)~h? :Bich ~hu!), ~~, :Duo'nE}clfnh 2:Jl1c , 9(in cdm o'n toan thi qu9 thd!) co honE} khoa {lc:IVJJ ua ~honE} Qudn [9 ~au r.Ddt cia E}iup cia,toi honE} j.udt qua hLnh h9C tqiP, {luo'i cunE}' con xin cam dn conE} [aD :Ba-cfli!? cianuoi ndnE} ua cham j.oc cho con ho'n hat muo'i nam qua. Em xin cdm o'n clfnh dtai cia [0 cho E.m tl2 nho ciin [dn, 9(in cdm o'n dVE}9C ~hdo. nE}uo'i U9' !)iu thuo'nE} nhdt cia thanE} cdm ua chLa xl nhl1nE} bu6n uuL cua toi honE} j.uo't nhl1nE}nam than!) qua! ~~, dt6 Chi cfli!inhnE}a!)22 thanE} 11nam 2°°4 dVE}u!)ln cHa §ianE}