Kết quả thực nghiệm

Một phần của tài liệu Khai phá tập mục lợi ích cao sử dụng cấu trúc cây tiền tố (Trang 69 - 92)

Kết quả thực nghiệm khai phá dữ liệu trên tệp CSDL.TXT đã khẳng định những vấn đề lý thuyết trong khai phá tập mục lợi ích cao đã trình bày ở chương 2.

Kết quả khai phá tập mục lợi ích cao do chương trình thực nghiệm với lãi suất 20% đã phát hiện được ra 24 nhóm mặt hàng mang lại lợi nhuận cao, từ đó hỗ trợ rất tốt cho các nhà quản lý siêu thị trong việc tổ chức kinh doanh.

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/

KẾT LUẬN

Kết quả đạt đƣợc trong luận văn

Luận văn đã nghiên cứu mô hình mở rộng của bài toán tìm tập mục thường xuyên là bài toán tìm tập mục lợi ích cao. Từ khi bài toán này được giới thiệu cho đến nay có khá nhiều thuật toán của nhiều nhóm nghiên cứu trên thế giới đề xuất. Vì vậy cần phải lựa chọn và nghiên cứu những thuật toán hiệu quả nhất một cách sâu sắc để góp phần hệ thống lại các kiến thức cơ bản trong lĩnh vực khám phá tri thức và khai phá dữ liệu. Mục tiêu của luận văn cũng muốn giúp cho những người mới nghiên cứu có thể tiếp cận nhanh những kiến thức cập nhật của thế giới trong lĩnh vực này.

Luận văn đã khái quát vấn đề về khai phá dữ liệu và khai phá tập mục thường xuyên, trình bày những khái niệm cơ bản và các cách tiếp cận để khai phá tập mục lợi ích cao. Đồng thời trình bày chi tiết hai thuật toán điển hình dựa trên cấu trúc dạng cây tiền tố tìm tập mục lợi ích cao là thuật toán COUI-Mine và UP-Growth. Các thuật toán được minh họa qua ví dụ cụ thể và có nhận xét về tính hiệu quả.

Phần thực nghiệm, luận văn đã xây dựng được chương trình khai phá phát hiện nhóm các mặt hàng mang lại lợi nhuận cao trên tập dữ liệu bán hàng của siêu thị Tỉnh Hòa Bình.

Hƣớng nghiên cứu tiếp theo

Trên cơ sở nghiên cứu đã được trình bày trong luận văn, tiếp tục nghiên cứu sâu hơn các thuật toán khai phá tập mục lợi ích cao, tìm cách cải tiến nhằm nâng cao hiệu quả của các thuật toán để áp dụng vào một số bài toán khai phá dữ liệu đang đặt trong nhiều lĩnh vực, đặc biệt trong lĩnh vực kinh doanh.

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/

TÀI LIỆU THAM KHẢO

Tiếng Việt

[1] Vũ Đức Thi, Nguyễn Huy Đức (2008), “Thuật toán hiệu quả khai phá tập mục lợi ích cao trên cấu trúc dữ liệu cây”, Tạp chí Tin học và Điều khiển học, 24(3), tr. 204-216.

[2] Nguyễn Huy Đức (2009), “Khai phá tập mục cổ phần cao và lợi ích cao trong cơ sở dữ liệu”. Luận án tiến sĩ toán học, Viện Công nghệ Thông tin, Hà Nội.

[3] Nguyễn Thanh Thủy (2003), Phát hiện tri thức và khai phá dữ liệu: Công cụ, phương pháp và ứng dụng.

Tiếng Anh

[4] R. Agrawal, T. Imielinski, and A. N. Swami (1993), “Mining association rules between sets of items in large databases”. In Proceedings of the 1993 ACM

SIGMOD International Conference on Management of Data, Washington, D.C.

[5] Han J., Pei J., and Yin Y. (2000), “Mining frequent patterns without candidate generation”, In ACM SIGMOD Intl. Conference on Management of Data,

pp. 1-12.

[6] Han J. and Kamber M., Data Mining: Concepts and Techniques, University of Illinois, Morgan Kaufmann Publishers, 2002.

[7] Grahne G. and Zhu J. (2003), “Efficient using prefix-tree in mining frequent itemsets”, in Proc. IEEE ICDM Workshop on Frequent Itemset Mining

Implementations, Melbourne, FL.

[8] El-Hajj M. and Zaiane Osmar R. (2003), “Non recursive generation of frequent k-itemsets from frequent pattern tree representations”, In Proc. Of 5th International Conference on Data Warehousing and Knowledge Discovery

(DaWak’2003), pp. 371-380.

[9] El-Hajj M. and Zaiane Osmar R. (2003), “COFI-tree Mining: A New Approach to Pattern Growth with Reduced Candidacy Generation”, In Proc. 2003

Int’l Conf.on Data Mining and Knowledge Discovery (ACM SIGKDD), Chicago,

Illinois, USA.

[10] Liu Y., W. Liao K., and Choudhary A. (2005), “A fast high utility itemsets mining algorithm”, in Proc. 1st Intl. Conf. on Utility-Based Data Mining, Chicago Chicago Illinois, pp.90-99, USA.

[11] Yao H., Hamilton H. J., and Butz C. J. (2004), “A foundational Approach to Mining Itemset Utilities from Databases”, Proceedings of the 4th (adsbygoogle = window.adsbygoogle || []).push({});

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/

[12] Yao H., Hamilton H. J. (2006), “Mining Itemsets Utilities from Transaction Databases”, Data and Knowledge Engeneering, Vol. 59, issue 3.

[13] Yao H., Hamilton H. J., and Geng L. (2006), “A Unified Framework for Utility Based Measures for Mining Itemsets”, UBDM’06 Philadelphia, Pennsylvania, USA.

[14] Vincent. S. Tseng, C. W. Wu, B. E. Shie, and P. S. Yu. (2010), “UP- Growth: An Efficient Algorithm for High Utility Itemset Mining”. In Proc. of

ACM-KDD, Washington, DC, USA, pp. 253-262, July 25-28.

[15] Chowdhury Farhan Ahmed, Syed Khairuzzaman Tanbeer, Byeong- Soo Jeong, Young-Koo Lee (2009), “Efficient tree structures for high utility pattern mining in incremental databases”, IEEE Transactions on Knowledge and Data

Engineering, Vol. 21, No. 12, december 2009.

[16] Ramaraju Chithra, Savarimuthu Nickolas (2012), “HUPT–mine: an efficient algorithm for high utility pattern mining”, Business Administration, Vol. 6, No. 3/2012, pp279-295.

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/

PHỤ LỤC Mã nguồn của chƣơng trình:

#include<stdio.h> #include<fstream> #include<iostream> #include<malloc.h> #include<vector> #include<conio.h> #include<time.h> #include"DeclareGlobalVariables.h" usingnamespace std;

////////////////////////////////Định nghĩa các hàm được dùng trong chương trình chính.

void Initialize () {

ItemStructArray = (ItemStruct*) malloc ((NumberOfItems)* sizeof(ItemStruct));

for (int i=0; i<NumberOfItems; i++) {

ItemStructArray[i].Item = i; ItemStructArray[i].Twu= 0; }

HUItemsArray = (HUItemsStructure*) malloc ((NumberOfItems)* sizeof

(HUItemsStructure));

for (int i=0; i<NumberOfItems; i++) { HUItemsArray[i].Item = 0; HUItemsArray[i].Twu = 0; HUItemsArray[i].cohuFirst = NULL; HUItemsArray[i].huFirst = NULL; HUItemsArray[i].cohuTwu = 0; }

FindInHashTable = (int *)malloc((NumberOfItems)*sizeof(int)); //Khoi tao bang bam

for (int i=0;i<NumberOfItems;++i) {

FindInHashTable[i] = -1; }

}

//--- //Hàm đọc lợi ích của các mục vào 1 mảng

void ReadUnitUtil() {

char c ;

if( (fp = fopen( "Utable.txt","r" )) == NULL ) {

cout<<"File Utable.txt khong the mo duoc\n"; _getch();

exit(1); }

do { (adsbygoogle = window.adsbygoogle || []).push({});

int item = 0 ; //Luu gia tri cua mot muc

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/

c = getc(fp);

while((c >= '0') && (c <= '9')) {

item *=10;

item += int(c)-int('0'); c = getc(fp); pos++; } if (pos) { UnitUtil.push_back (item) ; } }while(!feof(fp)); fclose(fp) ;

NumberOfItems = (int) UnitUtil.size (); }

//--- //Doc mot dong co so du lieu vao mang OneTransaction.

void ReadDatabase() { char c ; int count ; OneTransaction.TU = 0; OneTransaction.NumberOfSaled.clear (); count = 0 ; do {

int item = 0 ; //Luu gia tri cua mot muc

int pos = 0 ; //Dung de dem so chu so cua mot muc.

//dung de dem so muc (mat hang) co trong csdl c = getc(fp);

while((c >= '0') && (c <= '9')) {

item *=10;

item += int(c)-int('0'); c = getc(fp); pos++; } if (pos) { OneTransaction.NumberOfSaled.push_back (item) ; count++; OneTransaction.TU += item*UnitUtil[count-1]; }

}while((c != '\n') && (!feof(fp))); }

//--- //Hoán đổi vị trí 2 phần tử trong mản HUItemsArray

void Swap (int index1, int index2) {

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/ temp = HUItemsArray[index1] ; HUItemsArray[index1] = HUItemsArray[index2] ; HUItemsArray[index2] = temp ; } //--- //Sắp xếp lại mảng HUItemsArray theo thứ tự tăng dần của TWU.

void SortHUArray(int low, int up, int size) {

int pass;

int upPivot = up++ ;

int pivot = low;

if (low >= upPivot) return;

do { pass = 1 ; while (pass == 1) { if (++low < size) { If (HUItemsArray[low].Twu<HUItemsArray[pivot].Twu) pass = 1 ; else pass = 0 ; } else pass = 0 ; }

//Find out, from the tail of HUItemsArray pass = 1; while (pass == 1) { if (up-- > 0) { if (HUItemsArray[up].Twu >HUItemsArray[pivot].Twu) pass = 1 ; else pass = 0 ; } else pass = 0 ; }

//Doi cho 2 phan tu cua mang huitemsarray

if (low < up)

Swap (low, up); }

while (low <= up); Swap(pivot,up); (adsbygoogle = window.adsbygoogle || []).push({});

SortHUArray(pivot, up-1, size); SortHUArray(up+1, upPivot, size);

return; }

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/

//--- //Sap xep lai mang TransactionArray

void SortOneTransaction( long lo, long up ) { int i, j; ItemRecord temp; while ( up>lo ) { i = lo; j = up;

temp = huTransaction.HUItemsArray [lo]; //Split file in two

while ( i<j ) {

for (; huTransaction.HUItemsArray[j].Index > temp.Index; j--); for (huTransaction.HUItemsArray[i]=huTransaction.

HUItemsArray [j]; i<j && huTransaction.HUItemsArray [i].Index < temp.Index; i++); huTransaction.HUItemsArray [j] = huTransaction.HUItemsArray[i];

}

huTransaction.HUItemsArray [i] = temp; //Sort recursively, the smallest first

if (i-lo< up-i) {SortOneTransaction(lo,i-1); lo = i+1;}

else {SortOneTransaction(i+1,up); up = i-1;} }

}

//---

void SortCandidateTransaction(long lo, long up) { int i, j; CandidateItem temp; while ( up>lo) { i = lo; j = up;

temp = HU4Candidate.HUItemsArray [lo];

while ( i<j) {

for (; HU4Candidate.HUItemsArray[j].Index > temp.Index ; j--); for (HU4Candidate.HUItemsArray[i] = HU4Candidate.

HUItemsArray [j]; i<j && HU4Candidate.HUItemsArray [i].Index < temp.Index; i++); HU4Candidate.HUItemsArray [j] = HU4Candidate.HUItemsArray[i];

}

HU4Candidate.HUItemsArray [i] = temp; //Sort recursively, the smallest first

if (i-lo<up-i){SortCandidateTransaction(lo,i-1); lo = i+1;}

else { SortCandidateTransaction(i+1,up); up = i-1;} }

}

//---

void ScanForLocation(int& NumberOfHUItems) {

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/ int j = 0 ; ItemRecord temp; huTransaction.HUItemsArray.clear (); huTransaction.TU = 0; while (j < NumberOfItems) {

if ((FindInHashTable[j] != -1) && (OneTransaction.NumberOfSaled[j] > 0)) {

temp.Item = j; (adsbygoogle = window.adsbygoogle || []).push({});

temp.Index = FindInHashTable[j];

huTransaction.HUItemsArray.push_back (temp);

huTransaction.TU +=OneTransaction.NumberOfSaled [j]*UnitUtil[j]; }

++j; }

NumberOfHUItems = huTransaction.HUItemsArray.size (); }

void GetHUOnly(int& NumberOfHUItems ) { int j = 0 ; CandidateItem temp; HU4Candidate.HUItemsArray.clear (); HU4Candidate.TU = 0; while (j < NumberOfItems) {

if ((FindInHashTable[j] != -1) && (OneTransaction.NumberOfSaled[j] > 0)) //Neu muc Trans.Items[j] la loi ich twu cao

{ temp.Item = j; temp.Index = FindInHashTable[j]; temp.Counter = OneTransaction.NumberOfSaled[j]; HU4Candidate.HUItemsArray.push_back (temp); } ++j; } NumberOfHUItems = HU4Candidate.HUItemsArray.size (); } //--- /*Cap nhat lai bang dau muc cho cay TWUITree sau khi them 1 not moi vao .

*/

void UpdateTable(struct ItemRecord OneItem, TWUITree* NewCurrent) {

int loc = OneItem.Index;

if (HUItemsArray[loc].huFirst == NULL) HUItemsArray[loc].huFirst = NewCurrent; else { NewCurrent->Next = HUItemsArray[loc].huFirst; HUItemsArray[loc].huFirst= NewCurrent; } }

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/

//--- //Hàm này có ý nghĩa tương tự.

void UpdateCOHUTable(struct ItemRecord OneItem, COUITree* NewCurrent) {

int loc = OneItem.Index ;

if (HUItemsArray[loc].cohuFirst == NULL) HUItemsArray[loc].cohuFirst = NewCurrent; else { NewCurrent->Next = HUItemsArray[loc].cohuFirst; HUItemsArray[loc].cohuFirst= NewCurrent; } } //---

bool SearchCOUIBrother( long nodeItem, COUITree*& NewCurrent, COUITree*& LastBrother) { bool found,over; found = false; over = false; LastBrother = NULL;

while ((NewCurrent != NULL) && (!found) && (!over)) { if (NewCurrent->Item == nodeItem) found = true; elseif (HUItemsArray[FindInHashTable[nodeItem]].cohuTwu > HUItemsArray[FindInHashTable[NewCurrent->Item]].cohuTwu) over = true; else { LastBrother = NewCurrent; NewCurrent = NewCurrent->Brother; } } return found; } /////////////////////////////////////////////////////////////////////////////////////////////////////

bool SearchHUTBrother(int nodeItem, TWUITree* & NewCurrent, TWUITree*& LastBrother)

{

bool found; found = false;

LastBrother = NULL;

while ((NewCurrent != NULL) && (!found)) { if (NewCurrent->Item == nodeItem ) { found = true; } else {

Số hóa bởi Trung tâm Học liệu http://www.lrc-tnu.edu.vn/ LastBrother = NewCurrent; NewCurrent = NewCurrent->Brother; } } return found; } //--- //Tim kiem not giong nhau trong cay candidate

bool SearchCandidateBrother(int nodeItem, CandidateTree* & NewCurrent, CandidateTree*& LastBrother)

{

bool found; found = false;

LastBrother = NULL;

while ((NewCurrent != NULL) && (!found)) { if (NewCurrent->Item == nodeItem ) { found = true; } else { LastBrother = NewCurrent; NewCurrent = NewCurrent->Brother; } } return found; } ///////////////////////////////////////////////////////////////////////////////////////////////////// (adsbygoogle = window.adsbygoogle || []).push({});

void AddNewChildWithBrother(struct HUTransaction huTransaction, int i, TWUITree* FatherNode, TWUITree* LastBrother, TWUITree*& NewCurrent)

{

TWUITree* node = new TWUITree;

node->Item = huTransaction.HUItemsArray[i].Item ; node->TWU = huTransaction.TU ; node->Depth = FatherNode->Depth + 1 ; node->Child = NULL; node->Next = NULL; node->Father = FatherNode; node->Brother = FatherNode->Child ; FatherNode->Child = node ; NewCurrent = node; } /////////////////////////////////////////////////////////////////////////////////////////////////////

void AddNewChildNoBrother(struct HUTransaction huTransaction, int i, TWUITree* FatherNode, TWUITree*& NewCurrent)

Một phần của tài liệu Khai phá tập mục lợi ích cao sử dụng cấu trúc cây tiền tố (Trang 69 - 92)