1 / 42

PrefixSpan﹕ Mining Sequential Patterns Efficiently by Prefix-Projected Pattern Growth

PrefixSpan﹕ Mining Sequential Patterns Efficiently by Prefix-Projected Pattern Growth. 學生 : 907737 張資昊 907747 蔡明成 指導老師 : 劉俞志. 名詞解釋. items : 在顧客交易資料庫中的一種產品,稱之為一個 item 。 itemset : 由一個以上的 items 所組成的一個非空集合,其中表示為一個 item 。

Télécharger la présentation

PrefixSpan﹕ Mining Sequential Patterns Efficiently by Prefix-Projected Pattern Growth

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PrefixSpan﹕Mining Sequential Patterns Efficiently by Prefix-Projected Pattern Growth 學生 : 907737 張資昊 907747 蔡明成 指導老師 : 劉俞志

  2. 名詞解釋 • items: 在顧客交易資料庫中的一種產品,稱之為一個item。 • itemset: 由一個以上的items所組成的一個非空集合,其中表示為一個item。 • sequence and element: 由一個以上的itemset所組成一個有順序性的序列。其中表示為一個itemset,也就是element。 • length:一個sequence中所存在的item數量。 • l - sequence:長度為l 的sequence。

  3. 名詞解釋(續) • subsequence and super sequence:定義sequence α = 〈aa…a〉, sequence β = 〈bb…b〉,如果存在整數1j<j<…jm,使得ab,ab,…,ab,則我們稱α為β的subsequence,而β為α的super sequence或稱為β contain α。本文中標示為α β。 • sequence database:由一群〈sid, s〉紀錄所構成的集合,其中sid為sequence_id,且s為一sequence。

  4. 名詞解釋(續) • (frequent) sequential pattern:若sequence database存在一個sequence α使得support(α)  ξ(a positive integer as the support threshold),則我們稱之為(frequent) sequential patterns。 • l - pattern:長度為l的sequential pattern。 • support:一個sequence α在sequence database S中的support,就是此database中containing α的tuple數量。本文中標示為support(α)

  5. 目的 • Sequential pattern mining在資料挖礦中是一個重要的問題,之前的做法大多數都是以Apriori演算法為基礎,但此方法在資料庫龐大或sequential pattern大量與長度較長時,其效能將出現問題。在本篇文章中,作者提出一個新的方法叫做PrefixSpan - (Prefix-projected Sequential Pattern),它不僅可以大大地減少candidate subsequence的產生,更可以大量地降低projected database所需的空間,使得程序變得有效率。此外,在大量序列的資料庫中挖掘sequential pattern,其效能勝於Apriori-based GSP演算法和FreeSpan,改善了以往效能不佳的問題。

  6. 三種演算法比較

  7. GSP • GSP是一個典型的Apriori-like mothod,它採用了multiple-pass與candidate-generation-and-test 的方式在sequential pattern mining上。 • 主要步驟如下﹕ • 先掃描出所有length-1的frequent sequence,將它存於seed set之中(在此seed set之中即為sequential pattern),接著做 • Step1(generate)﹕利用seed set內的sequence,組合成length加1的candidate sequences。 • Step2(test)﹕測試各個candidate sequence support是否大於min_support,若大於,則存此candidate sequence於seed set之中。 • 不斷重複上述兩個Step,直到沒有candidate大於min_support,則此seed set內的資料即為sequential pattern。過程如下﹕

  8. generate Candidate sequence (length-i+1) Seed set (length-i) Test(>min_support) GSP(續)

  9. GSP(續)Example 先掃描找出length-1的frequent sequence﹕<a><b><c><d><e><f>放入seed set中(seed set = <a,b,c,d,e>),接著產生length-2的candidate﹕<aa><ab>…<af><ba><bb>…<bf>…<fa>…<ff><(ab)><(ac)>..<(af)><(bc)><(bd)>…<(bf)>…<(ef)>,接著測試各個candidate是否大於min_support,若大於則加如seed set中,接著找length-3的candidate…依此類推,最後seed set中即為sequential patter。 Table1.A sequence database

  10. GSP(續) Apriori-like的缺點 • 會產生大量的candidate sequence (例如:1000個length-1的frequent sequence將會產生1,499,500個候選序列)。 • 必須重複多次掃描資料庫。 • 難以挖掘較長的sequential pattern。

  11. FreeSpan • 其主要概念是利用frequent item將序列資料庫投射(project)成幾個較小的projected database,再分別對這些projected database裡的子序列進行同樣的拆解程序,以判斷是否為高頻序列。以下以Table1為例﹕

  12. FreeSpan(續) • 首先搜尋資料庫一次找出所有的frequent item,並依出現的頻率採降冪排序,其表現形式為f_list = {a:4, b:4, c:4, d:3, e:3, f:3},”:”號前面代表高頻項目;後面代表該高頻項目出現的頻率次數。 • 將上述的f_list視為6個子集並分別建構成6個projected database,分別為<a>-projected database, <b>-projected database, ..... , <f>-projected database。每個<x>-projected database會包含擁有item x的所有序列,並移除掉f_list中排序在item x後面的所有item,例如<b>-projected database會包含4個序列:<a(ab)a>、<aba>、<(ab)b>、<ab>。 • 搜尋projected database可找出擁有item x但排除f_list中排序在item x後面的item的序列型樣,如上例的<b>-projected database可找出<b>、<ab>、<ba>、<(ab)>型樣。

  13. FreeSpan(續) 4如此採各個擊破的方式,以類似的方法在projected database中反覆遞迴地執行以期找出所有的序列型樣。 • 由於FreeSpan將原始的序列資料庫投射成幾組較小的projected database,可有效地侷限搜尋的範圍,因此FreeSpan會比GSP效能來的好。然而若有一個型樣皆出現在每一個序列中,則所產生的projected database勢必無法縮小,如上例的<f>-projected database其大小幾乎與原來的序列資料庫一樣,針對這種情形所產生的搜尋成本也會提高。

  14. Mining sequential patterns by prefix projections • 一般sequence中element所包含的items是未經過整理且沒有一定順序性的,因此本文在此假設element中的items是透過字母排序的。例如,將〈a(bac)(ca)d(fc)〉整理為〈a(abc)(ac)d(cf)〉使得sequence的表示方法得以一致。

  15. Mining sequential patterns by prefix projections (續)

  16. Mining sequential patterns by prefix projections (續)Example • Example (PrefixSpan) ﹕我們使用Table 1中的sequence database S及min_sup為2例子透過prefix-projection method來mining,如以下步驟: • Step 1:先找length-1的sequential patterns。透過掃描S一次我們可以得到length-1的sequential pattern〈a〉:4, 〈b〉:4, 〈c〉:4, 〈d〉:3, 〈e〉:3, 〈f〉:3(〈pattern〉:計算出的support值)。 • Step 2:分割搜尋空間。將這些sequential patterns切割為六個,包括(1)具有prefix〈a〉;…;(6)具有prefix〈f〉的。 • Step 3:找出sequential patterns的subsets。 藉由以下方法建立projected databases及利用遞迴方式來mining,如Table 2﹕

  17. Mining sequential patterns by prefix projections (續)Example • (1) 先找具有prefix〈a〉的sequential patterns。所以我們只將具有〈a〉且開頭為〈a〉的subsequence納入projected database。例如,在sequence 〈(ef)(ab)(df)cb〉中,我們只將〈(_b)(df)cb〉作為我們找尋sequential patterns的考量。值得注意的是,(_b)表示a在一個element中是相連在b之前的。而對於sequence 〈a(abc)(ac)d(cf)〉而言,只有〈(abc)(ac)d(cf)〉這個subsequence是我們所要考量的。

  18. Mining sequential patterns by prefix projections (續)Example • (2) 經由(1)之後,在sequence database S中的sequence有四個postfix sequences被投影到〈a〉-projected database:〈(abc)(ac)d(cf)〉,〈(_d)c(bc)(ae)〉,〈(_b)(df)cb〉,〈(_f)cbc〉。而經過一次的掃描〈a〉-projected database後,我們可以得到具有prefix〈a〉且length-2的sequential patterns〈aa〉:2, 〈ab〉:4,〈(ab)〉:2,〈ac〉:4, 〈ad〉:2,〈af〉:2。而我們又可如同遞迴方式將這些sequential patterns切割為六個包括(1)具有prefix〈aa〉;(2)具有prefix〈ab〉;…;(6)具有prefix〈af〉的,同時在去產生他們各自的projected database。

  19. Mining sequential patterns by prefix projections (續)Example • (3) 當某個prefix的projected database只剩下少於min_sup的(postfix) subsequences時,我們就可確定其無法再產生sequential patterns了,也就不用繼續再進行下去了。如上例中〈aa〉-projected database只會剩下一個subsequence 〈(_bc)(ac)d(cf)〉。

  20. Mining sequential patterns by prefix projections (續)Example

  21. PrefixSpan:Algorithm and correctness 藉由Lemma3.1,PrefixSpan便可透過以遞迴(recursive)的方式將問題分割解決。

  22. PrefixSpan:Algorithm and correctness(續) 定義了α-projected database的意義。

  23. PrefixSpan:Algorithm and correctness(續)

  24. PrefixSpan:Algorithm and correctness(續) 定義了α-projected database的相關特性。

  25. PrefixSpan:Algorithm and correctness(續)

  26. Scaling up pattern growth by bi-level projection • 由於PrefixSpan的主要成本在於projected databases的建立,因此本節利用bi-level projection來降低projected database的空間,其介紹如下﹕ • Example4 ﹕ • Step1﹕與3.2節level-by-level projection方式相同,先掃描序列資料庫S找出length-1 sequential pattern﹕<a>,<b>,<c>,<d>,<e>,<f>. • Step2﹕用6×6matrix代替建立projected database-如下圖Table3﹕

  27. Scaling up pattern growth by bi-level projection(續) 舉例而言,M[c,c]=3表示序列<cc>有出現在S中的三個序列。M[a,c]=(4,2,1)表示=4, =2和=1。

  28. Scaling up pattern growth by bi-level projection(續) • 對每一個length-2的αsequential pattern,建構α-projected database,舉例而言,<ab>-projected database包含三個sequences﹕<(_c)(ac)(cf)>,<(_c)a>,<c>,藉由掃描它們一次,三個frequent items可被發現﹕<a><c><(_c)>,然後3×3 S-matrix的<ab>-projected database可被建立,如下圖Table4﹕

  29. Scaling up pattern growth by bi-level projection(續) • 由圖所示,只有<(_c)a>可以被產生成sequential pattern(support=2),不需要進一步的projection(因為其中有一sequence<(_c)a>已無希望產生更長的pattern),所以bi-level的方法較level-by-level節省空間,以Example3為例,level-by-level需產生53個projected database,而用bi-level只需產生22個(只需要length-2的sequential pattern)。

  30. Scaling up pattern growth by bi-level projection(續) 定義S-matrix中某個item自己與自己所表達的涵意。

  31. Scaling up pattern growth by bi-level projection(續) 定義S-matrix中某個item自己與別人所表達的涵意。

  32. Pseudo-Projection • 對於PrefixSpan而言,最主要的成本在於不斷的遞迴建置projected database。所以本文採用一種所謂pseudo-projection technique來減少這些建置成本。這是一種藉由儲存對應sequence之pointer及offset的方式來省去儲存大量postfix subsequences的空間。

  33. 2 〈a(abc)(ac)d(cf)〉 Pseudo-Projection(續) • 例如,我們之前在〈a〉-projected database中存放s = 〈a(abc)(ac)d(cf)〉的postfix sequence 〈(abc)(ac)d(cf)〉,而現在改為存放一包含指到s的pointer及offset = 2的資料結構即可,如此一來就可以省下大量的儲存空間及增進效率。但是這種方法只適用在能夠將database都匯入到main memory情形,如果適用於disk-base的存取方式則會變得沒有效率。

  34. Experimental Results and Performance Study • 實驗配備:233MHz Pentium PC machine with 128 megabytes main memory,running Microsoft Windows/NT. All the method using Microsoft Visual C++ 6.0。 • 4種方法之效能比較﹕ • GSP. • FreeSpan. FreeSpan with alternative level projected. • PrefixSpan-1. PrefixSpan with level-by-level projected. • PrefixSpan-2. PrefixSpan with bi-level projected.

  35. Experimental Results and Performance Study(續) • 如左圖,當threshold很變高時,所得到的sequential patterns都很短,四種方法的running time十分接近。而當threshold慢慢變小時,它們之間的區隔就變得明顯了。 • Dataset C10T8S8I8:item的數量1,000,sequence數量10,000,每個element平均包含8個items(T8),每個sequence平均包含8個sequences(S8)。

  36. Experimental Results and Performance Study(續) • 比較有使用pseudo-projections及沒使用的效能。很明顯的,有使用pseudo技術明顯效能較好,尤其當threshold越小時,它們之間的差距就明顯。

  37. Experimental Results and Performance Study(續) • 當dataset變為C1kT8S8I8 :item的數量1,000,sequence數量1,000,000,每個element平均包含8個items(T8),每個sequence平均包含8個sequences(S8))時,四種方法的中沒有pseudo優於有pseudo的(因為在太多sequence時造成大量的I/O Cost);而當threshold變低時bi-level也明顯優於Level-by-level的方法。

  38. Experimental Results and Performance Study(續) • 假設Threshold設為20%,而隨著sequence的增加,此兩種方法的running time都呈現線性成長。而其中PrefixSpan-2效能表現優於PrefixSpan-1。

  39. Experimental Results and Performance Study(續) • 總結以上,此效能測試顯示在threshold較小時,效能及擴充性表現PrefixSpan優於FreeSpan及GSP,而FreeSpan又優於GSP;而PrefixSpan-2使用bi-level可大量減少Projection的數量,所以在低low threshold需產生大量projection時,效能表現優於PrefixSpan-1。而若能將database全部載入main memory,則能使用pseudo的方法來增加效能及節省空間。

  40. 問題討論 • PrefixSpan與FreeSpan產生pattern方法皆著重在與frequent item有關的projected database,故其效能較佳。 • PrefixSpan較FreeSpan能有效縮減projected database。 • Apriori 的特性被整合到PrefixSpan的bi-level projection(例如3-way checking)。

  41. 結論與評論 • 在此篇文章中,作者提供了一個創新、具擴充性而且有效率的sequential mining method叫做PrefixSpan,並且提供了bi-level與pseudo-projection進一步的改善它的效能,有效地解決了以往的Apriori-like在資料庫龐大或序列過長時,效能不佳的問題,是一篇具有顯著貢獻的文章。

  42. Q & A

More Related