
de163b0a426894750fab4167669e31af.ppt
- Количество слайдов: 68
Course 3 挖掘關聯式規則 Mining Association Rules Data Mining 資料探勘 國立聯合大學 資訊管理學系 陳士杰老師
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Outlines u 關聯分析的基本概念與準則 (Basic Concepts and Road Map) u 有效率且可行的頻繁項目集挖掘方法 (Efficient and scalable frequent itemset mining methods) u 挖掘多樣化的關聯規則 (Mining various kinds of association rules) u 從關聯挖掘到相關性分析 (From association mining to correlation analysis) u 具有限制的關聯挖掘 (Constraint-based association mining) u Summary 2
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Basic Concepts and a Road Map u Frequent pattern: a pattern (a set of items, items pattern subsequences, substructures, etc. ) that occurs frequently subsequences substructures in a data set u Motivation: Finding inherent regularities in data n What products were often purchased together? — Beer and diapers? ! n What are the subsequent purchases after buying a PC? n What kinds of DNA are sensitive to this new drug? n Can we automatically classify web documents? 3
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) “尿布與啤酒”──典型關聯分析案例 在美國,一些年輕的父親下班後經常要到超市去 買嬰兒尿布,超市也因此發現了一個規律,在購 買嬰兒尿布的年輕父親們中,有30%~ 40%的人 同時要買一些啤酒。超市隨後調整了貨架的擺放, 把尿布和啤酒放在一起,明顯增加了銷售額。 u 同樣的,我們還可以根據關聯規則在商品銷售方 面做各種促銷活動。 u u Applications n Basket data analysis, analysis cross-marketing, sale campaign analysis, and DNA sequence analysis. 4
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 5
國立聯合大學 資訊管理學系 u 資料探勘課程 (陳士杰) 如果問題的全域是商店中所有商品的集合,則對每種商品 都可以用一個布林量來表示該商品是否被顧客購買,則每 個購物籃都可以用一個布林向量表示;而透過分析布林向 量則可以得到商品被頻繁關聯或被同時購買的模式,這些 模式就可以用關聯規則表示。 (0001001100,這種方法失去了什麼訊息?) 6
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) What Is Association Mining? u Association rule mining: n u Finding frequent patterns, associations, correlations, or causal patterns associations correlations structures among sets of items or objects in transaction databases, relational databases, and other information repositories. Examples. n Rule form: “Body Head [support, confidence]”. ¡ buys(x, “diapers”) buys(x, “beers”) [0. 5%, 60%] ¡ major(x, “CS”) ^ takes(x, “DB”) grade(x, “A”) [1%, 75%] 7
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 8 Association Rule: Basic Concepts u 給定︰ n n The task-relevant data D: 是資料庫交易的集合,每個 交易T則是項目的集合,使得 n 每個交易由交易識別符號TID標識; n u Items set: I={i 1, i 2, . . . , im} A, B為兩個項目集合,交易T包含A if and only if 關聯規則是如下蘊涵式︰ n 其中 並且 ,規則 D中成立,並且具有支持度s和置信度c 在資料集
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 9 範例 u u 項目集合 I={A, B, C, D, E, F} 每個交易T由交易識別符號TID標識,它是項目集合 n u 比如︰TID(2000)={A, B, C} 任務相關資料D是資料庫交易的集合
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 10 Terminologies u Item n n u Itemset n n u {I 1}, {I 2}, {A}, … 2 -Itemset n u {I 1}, {I 1, I 7}, {I 2, I 3, I 5}, … {A}, {A, G}, {B, C, E}, … 1 -Itemset n u I 1, I 2, I 3, … A, B, C, … {I 1, I 7}, {I 3, I 5}, {A, G}, … K-itemset
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 11 Rule Measures: Support and Confidence Customer buys both Customer buys diaper A u Find all the rules A B with minimum confidence and support n n Customer buys beer B u support, s, probability that a support transaction contains {A ∪ B} confidence, c, conditional confidence probability that a transaction having {A} also contains B Let minimum support 50%, and 50% minimum confidence 50%, we 50% have: n n A C (50%, 66. 6%) C A (50%, 100%)
國立聯合大學 資訊管理學系 u n n 最小support控制了一個規則必須涵蓋的最少資料數目 最小的confidence則控制了這個規則的預測強度 當挖掘演算法找出滿足使用者訂定的最小support和confidence的關連規則, 這個規則才算成立。 舉例來說,如果要產生A B(當發生A時,則會發生B)的關連規則 時,我們所需要找出的itemsets便是{AB},如果: n n u 12 在探討關連規則的挖掘之前,我們必須先了解: n u 資料探勘課程 (陳士杰) 我們設定最小support值為 40%,且資料庫中有10, 000筆交易記錄,則 40% {AB}這個itemsets所出現的筆數必須大於等於 4, 000(10, 000 40%)才算 frequent itemsets(又稱large itemsets) 在{A}出現的所有記錄中,{B}也同時出現的比例,便是A B這個關連 也同時出現的比例 規則的confidence,假設我們設定的最小confidence值為 60%,則{AB}出 60% 現的次數除以所有含有{A}的記錄數目所得的比例,若大於等於 60%,則 表示這一個規則成立。 上述的例子我們若以數學式來表示,support便是P(A ∪ B)的機率, confidence則是以條件機率P(B|A)表示,可整理成下面的式子: n n support(AÞB) = P(A ∪ B) confidence(AÞB) = P(B|A)
國立聯合大學 資訊管理學系 u 資料探勘課程 (陳士杰) 大型資料庫中的關聯規則挖掘包含兩個過程︰ n 找出所有頻繁項目集 ¡ n 大部分的計算都集中在這一步 由頻繁項目集產生強關聯規則 ¡ 即滿足最小支持度和最小置信度的規則 13
國立聯合大學 資訊管理學系 u 資料探勘課程 (陳士杰) Given: (1) database of transactions (交易資料庫) (2) each transaction is a list of items (一個項目列表,即: 消 費者一次購買活動中購買的商品) u Find: n all rules that correlate the presence of one set of items with that of another set of items ¡ u E. g. , 98% of people who purchase tires and auto accessories also get automotive services done Applications n n Maintenance Agreement (商店應該怎樣提高保 養用品的銷售? ) Home Electronics (其他商品的庫存有什麼影響 ? ) 14
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Association Rule Mining: A Road Map u Frequent pattern mining can be classified in various way: Based on the types of values handled in the rule (根據規則 中所處理的值類型) n Based on the number of data dimensions involved in the rule (根據規則中涉及的資料維度) n Based on the levels of abstraction involved in the rule (根據 規則所涉及的抽象層次) n 15
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Based on the types of values handled in the rule u Boolean associations n buys(x, “computer”) buys(x, “HP-printer”) n buys(x, “SQLServer”) ^ buys(x, “DMBook”) buys(x, “DBMiner”) u Quantitative associations n age(x, “ 30. . 39”) ^ income(x, “ 42. . 48 K”) buys(x, “high resolution TV”) 16
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Based on the number of data dimensions involved in the rule u Single dimension associations n buys(x, “computer”) buys(x, “HP-printer”) n buys(x, “SQLServer”) ^ buys(x, “DMBook”) buys(x, “DBMiner”) u Multiple dimensional associations n age(x, “ 30. . 39”) ^ income(x, “ 42. . 48 K”) buys(x, “high resolution TV”) 17
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Based on the levels of abstraction involved in the rule u Multiple-level analysis n Some association rule mining can find rules at differing levels of abstraction Age(x, “ 30… 39”) buys(x, “laptop_computer”) ¡ Age(x, “ 30… 39”) buys(x, “computer”) ¡ u Single level analysis n If the rules within a given set do not reference items or attributes at different levels of abstraction. 18
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Mining Association Rules in Large Databases u Some methods for mining the simplest form of frequent patterns – single-dimensional, single-level, Boolean frequent single-dimensional single-level itemsets (單維、單層、布林關聯規則的挖掘) ( n Apriori algorithm ¡ ¡ n How to generate strong association rules from frequent itemsets. Several variations to the Apriori algorithm for improved efficiency and scalability. Presents methods for mining frequent itemsets that do not involve the generation of “candidate” frequent itemsets. 19
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Mining Association Rules—An Example Min. support 50% Min. confidence 50% For rule A C: support = support({A∪C}) = 50% confidence = support({A∪C})/support({A}) = 66. 6% 20
國立聯合大學 資訊管理學系 u 資料探勘課程 (陳士杰) The Apriori principle: n Any subset of a frequent itemset must be frequent ¡ n if {beer, diaper, nuts} is frequent, so is {beer, diaper} Every transaction having {beer, diaper, nuts} also contains {beer, diaper} Apriori pruning principle: If there is any itemset which is infrequent, its superset should not be generated/tested! u Method: u generate length (k+1) candidate itemsets from length k frequent itemsets, and n test the candidates against DB n 21
資料探勘課程 (陳士杰) 國立聯合大學 資訊管理學系 22 The Apriori Algorithm — Example Database D C 1 Scan D itemset {1} {2} {3} {4} {5} sup. 2 3 3 1 3 C 2 itemset sup L 2 {1 2} {1 3} {1 5} {2 3} {2 5} {3 5} C 3 Scan D 1 2 3 2 L 1 C 2 Scan D L 3 最小支持度︰ 2
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 使用Apiori性質由L 2產生C 3 1. 連接: 連接 n C 3=L 2 = {{A, C}, {B, E}{C, E}} = {{A, B, C}, {A, C, E}, {B, C, E}} 2. 使用Apriori性質剪枝: 頻繁項目集的所有子集必須是頻繁 性質剪枝 的,對候選項C 3,我們可以刪除其子集為非頻繁的選項: n {A, B, C}的2項子集是{A, B}, {A, C}, {B, C},其中{A, B}不是L 2的元素, 所以刪除這個選項; n {A, C, E}的2項子集是{A, C}, {A, E}, {C, E},其中{A, E} 不是L 2的元素, 所以刪除這個選項; n {B, C, E}的2項子集是{B, C}, {B, E}, {C, E},它的所有2-項子集都是L 2 的元素,因此保留這個選項。 3. 這樣,剪枝後得到C 3={B, C, E} 23
資料探勘課程 (陳士杰) 國立聯合大學 資訊管理學系 The Apriori Algorithm u u Join Step: Ck is generated by joining Lk-1 with itself Prune Step: Any (k-1)-itemset that is not frequent cannot be a subset of a frequent k-itemset u Pseudo-code: Ck: Candidate itemset of size k Lk : frequent itemset of size k L 1 = {frequent items}; for (k = 1; Lk != ; k++) do begin Ck+1 = candidates generated from Lk; for each transaction t in database do increment the count of all candidates in Ck+1 that are contained in t Lk+1 = candidates in Ck+1 with min_support end return k Lk; 24
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 25
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Example of Generating Candidates u L 3={abc, abd, ace, bcd} u Self-joining: L 3*L 3 n n u abcd from abc and abd acde from acd and ace Pruning: n u acde is removed because ade is not in L 3 C 4={abcd} 26
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 由頻繁項目集產生關聯規則 u 同時滿足最小支持度和最小置信度的才是強關聯 規則,從頻繁項目集產生的規則都滿足支持度要 求,而其置信度則可由一下公式計算︰ u 每個關聯規則可由如下過程產生︰ n 對于每個頻繁項集l,產生l的所有非空子集; n 對于每個非空子集s,如果 則輸出規則“ ” 27
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Is Apriori Fast Enough? — Performance Bottlenecks u The bottleneck of Apriori: candidate generation n Huge candidate sets: ¡ ¡ n 104 frequent 1 -itemset will generate 107 candidate 2 -itemsets To discover a frequent pattern of size 100, e. g. , {a 1, a 2, …, a 100}, one needs to generate 2100 1030 candidates. Multiple scans of database: ¡ Needs (n +1 ) scans, n is the length of the longest pattern 28
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Mining Frequent Patterns Without Candidate Generation u Compress a large database into a compact, Frequent. Pattern tree (FP-tree) structure n n u highly condensed, but complete for frequent pattern mining avoid costly database scans Develop an efficient, FP-tree-based frequent pattern mining method n A divide-and-conquer methodology: decompose mining tasks into smaller ones n Avoid candidate generation: sub-database test only! 29
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 30 Construct FP-tree from a Transaction DB TID 100 200 300 400 500 Items bought (ordered) frequent items {f, a, c, d, g, i, m, p} {f, c, a, m, p} {a, b, c, f, l, m, o} {f, c, a, b, m} {b, f, h, j, o} {f, b} {b, c, k, s, p} {c, b, p} {a, f, c, e, l, p, m, n} {f, c, a, m, p} min_support = 0. 5 Steps: Header Table 1. Scan DB once, find frequent 1 -itemset (single item pattern) Item frequency head f 4 c 4 a 3 b 3 m 3 p 3 {} 2. Order frequent items in frequency descending order 3. Scan DB again, construct FP -tree f: 4 c: 3 c: 1 b: 1 a: 3 b: 1 p: 1 m: 2 b: 1 p: 2 m: 1
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Benefits of the FP-tree Structure u Completeness: n n u never breaks a long pattern of any transaction preserves complete information for frequent pattern mining Compactness n n reduce irrelevant information—infrequent items are gone frequency descending ordering: more frequent items are more likely to be shared never be larger than the original database (if not count node-links and counts) Example: For Connect-4 DB, compression ratio could be over 100 31
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Mining Frequent Patterns Using FP-tree u General idea (divide-and-conquer) n u Recursively grow frequent pattern path using the FP-tree Method n n n For each item, construct its conditional pattern-base, and then its conditional FP-tree Repeat the process on each newly created conditional FP-tree Until the resulting FP-tree is empty, or it contains only one path (single path will generate all the combinations of its sub-paths, each of which is a frequent pattern) 32
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Major Steps to Mine FP-tree 1) Construct conditional pattern base for each node in the FP -tree 2) Construct conditional FP-tree from each conditional pattern-base 3) Recursively mine conditional FP-trees and grow frequent patterns obtained so far § If the conditional FP-tree contains a single path, simply enumerate all the patterns 33
資料探勘課程 (陳士杰) 國立聯合大學 資訊管理學系 34 Step 1: From FP-tree to Conditional Pattern Base u u u Starting at the frequent header table in the FP-tree Traverse the FP-tree by following the link of each frequent item Accumulate all of transformed prefix paths of that item to form a conditional pattern base Header Table Item frequency head f 4 c 4 a 3 b 3 m 3 p 3 {} f: 4 c: 3 c: 1 b: 1 a: 3 b: 1 p: 1 Conditional pattern bases item cond. pattern base c f: 3 a fc: 3 b fca: 1, f: 1, c: 1 m: 2 b: 1 m fca: 2, fcab: 1 p: 2 m: 1 p fcam: 2, cb: 1
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 35 Properties of FP-tree for Conditional Pattern Base Construction u Node-link property n u For any frequent item ai, all the possible frequent patterns that contain ai can be obtained by following ai's node-links, starting from ai's head in the FP-tree header Prefix path property n To calculate the frequent patterns for a node ai in a path P, only the prefix sub-path of ai in P need to be accumulated, and its frequency count should carry the same count as node ai.
資料探勘課程 (陳士杰) 國立聯合大學 資訊管理學系 36 Step 2: Construct Conditional FP-tree u For each pattern-base n n Accumulate the count for each item in the base Construct the FP-tree for the frequent items of the pattern base Header Table Item frequency head f 4 c 4 a 3 b 3 m 3 p 3 {} f: 4 c: 3 c: 1 b: 1 a: 3 b: 1 p: 1 m-conditional pattern base: fca: 2, fcab: 1 {} f: 3 m: 2 b: 1 c: 3 p: 2 m: 1 All frequent patterns concerning m m, fm, cm, am, fcm, fam, cam, fcam a: 3 m-conditional FP-tree
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 37 Mining Frequent Patterns by Creating Conditional Pattern. Bases Item Conditional pattern-base Conditional FP-tree p {(fcam: 2), (cb: 1)} {(c: 3)}|p m {(fca: 2), (fcab: 1)} {(f: 3, c: 3, a: 3)}|m b {(fca: 1), (f: 1), (c: 1)} Empty a {(fc: 3)} {(f: 3, c: 3)}|a c {(f: 3)}|c f Empty
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 38 Step 3: Recursively mine the conditional FP-tree {} {} Cond. pattern base of “am”: (fc: 3) c: 3 f: 3 am-conditional FP-tree c: 3 a: 3 f: 3 {} Cond. pattern base of “cm”: (f: 3) f: 3 m-conditional FP-tree cm-conditional FP-tree {} Cond. pattern base of “cam”: (f: 3) f: 3 cam-conditional FP-tree
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 39 Single FP-tree Path Generation u Suppose an FP-tree T has a single path P u The complete set of frequent pattern of T can be generated by enumeration of all the combinations of the sub-paths of P {} f: 3 c: 3 a: 3 m-conditional FP-tree All frequent patterns concerning m m, fm, cm, am, fcm, fam, cam, fcam
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Principles of Frequent Pattern Growth u Pattern growth property n u Let be a frequent itemset in DB, B be 's conditional pattern base, and be an itemset in B. Then is a frequent itemset in DB iff is frequent in B. “abcdef ” is a frequent pattern, if and only if n “abcde ” is a frequent pattern, and n “f ” is frequent in the set of transactions containing “abcde ” 40
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Why Is Frequent Pattern Growth Fast? u Our performance study shows n FP-growth is an order of magnitude faster than Apriori, and is also faster than tree-projection u Reasoning n No candidate generation, no candidate test n Use compact data structure n Eliminate repeated database scan n Basic operation is counting and FP-tree building 41
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) FP-growth vs. Apriori: Scalability With the Support Threshold Data set T 25 I 20 D 10 K 42
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 43 Multiple-Level Association Rules u u Items at the lower level are expected to have lower support. All Items often form hierarchy u u 這意味著挖掘底層數據項之 間的關聯規則必須定義不 同的支持度 在適當的等級挖掘出來的數 據項間的關聯規則可能是 非常有用的 desktop printer software computer laptop financial edu. color Computer accessory mouse wrist pad b/w IBM Microsoft HP Sony Logitech Ergoway TID Items {IBM D/C, Sony b/w} T 1 T 2 {Ms. edu. Sw. , Ms. fin. Sw. } T 3 {Logi. mouse, Ergoway wrist pad} {IBM D/C, Ms. Fin. Sw. } T 4 {IBM D/C} T 5
國立聯合大學 資訊管理學系 u 資料探勘課程 (陳士杰) 通常,多層關聯規則的挖掘還是使用置信度-支 持度框架,可以採用Top-down策略 Top-down 持度 n 請注意: 概念分層中,一個節點的支持度肯定不小於該 節點的任何子節點的支持度 n 由概念層 1開始向下,到較低的更特定的概念層,對每 個概念層的頻繁項目計算累加計數 n 每一層的關聯規則挖掘可以使用Apriori等多種方法 n 例如︰ ¡ 先找高層的關聯規則︰computer -> printer [20%, 60%] ¡ 再找較低層的關聯規則︰laptop -> color printer [10%, 50%] 44
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 45 Multi-level Association: Uniform Support vs. Reduced Support u Uniform Support (一致支持度): n the same minimum support for all levels 優: One minimum support threshold. No need to examine itemsets containing any item whose ancestors do not have minimum support (容易採用最佳化策略 ). n 缺: Lower level items do not occur as frequently (最小支持度值設置困難). If support threshold ¡ too high miss low level associations ¡ too low generate too many high level associations n u Reduced Support (遞減支持度): n reduced minimum support at lower levels n There are 4 search strategies: ¡ ¡ Level-by-level independent (逐層獨立) Level-cross filtering by k-itemset (層交叉k項集過濾) Level-cross filtering by single item (層交叉單項過濾) Controlled level-cross filtering by single item (受控的層交叉單項過濾)
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 46 Uniform Support Multi-level mining with uniform support
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 47 Reduced Support Multi-level mining with reduced support
國立聯合大學 資訊管理學系 u 48 逐層獨立︰ n u 資料探勘課程 (陳士杰) 完全的寬度搜索,沒有頻繁項目集的背景知識用於剪 枝 層交叉單項過濾︰ n 一個第i層的項目被考察 if and only if 它在第(i-1)層的 父節點是頻繁的 min_sup = 12% min_sup = 3% Computer [support=10%] Laptop [未考察] Desktop [未考察] (computer) ( laptop computer, desktop computer)
國立聯合大學 資訊管理學系 u 資料探勘課程 (陳士杰) 49 層交叉k項目集過濾: n一個第i層的k項目集被考察if and only if它在第(i-1)層的 對應父節點k-項集是頻繁的 Computer and printer [support = 7%] min_sup = 5% min_sup = 2% Laptop computer and b/w printer [support = 1%] Laptop computer and color printer [support = 2%] (computer, printer) (( laptop computer, color printer), (desktop computer, b/w printer) …)
國立聯合大學 資訊管理學系 u 資料探勘課程 (陳士杰) 搜索策略比較 逐層獨立策略條件鬆,可能導致底層考察出大量非頻 繁項目 n 層交叉k項集過濾策略限制太強,僅允許考察頻繁k-項 目集的子女 n 層交叉單項過濾策略是上述兩者的折中,但仍可能丟 失低層頻繁項目 n 50
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 51 受控的層交叉單項過濾策略 u u 層交叉單項過濾策略的改進版本 設置一個層傳遞臨界值,用於向較低層傳遞相對頻繁的項 目。 n n 即如果滿足層傳遞臨界值,則允許考察不滿足最小支持度臨界值 的項目的子女 用戶對進一步控制多概念層上的挖掘過程有了更多的靈活性,同 時減少無意義關聯的考察和產生 min_sup = 12% level_passage_support = 8% Computer [support=10%] Laptop [support=6%] min_sup = 3% Desktop [support=4%]
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Multi-level Association: Redundancy Filtering u Some rules may be redundant due to “ancestor” relationships between items. u Example n n u desktop computer => b/w printer [sup=8%, con=70%] (1) IBM desktop computer => b/w printer [sup=2%, con=72%] (2) We say the first rule is an ancestor of the second rule. n 如果規則(2)中的項用它在概念分層中的“祖先”代替,能得到(1),而 且(1)的支持度和置信度都接近“期望”值,則(1)是冗餘的。 52
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Multi-Dimensional Association: Concepts u Single-dimensional rules: rules buys(X, “milk”) buys(X, “bread”) u Multi-dimensional rules: 2 dimensions or predicates (述語) rules n Inter-dimension association rules (沒有重覆出現的述語) age(X, ” 19 -25”) occupation(X, “student”) buys(X, “coke”) n hybrid-dimension association rules (有重覆出現的述語) age(X, ” 19 -25”) buys(X, “popcorn”) buys(X, “coke”) u 在多維關聯規則挖掘中,我們搜索的不是頻繁項目集, 而是頻繁述語集。k-述語集 (frequent k-predicate set) 是 頻繁述語集 包含k個述語的集合。 n 例如︰{age, occupation, buys}是一個3 -述語集 53
國立聯合大學 資訊管理學系 u 資料探勘課程 (陳士杰) 數據屬性可以分為分類屬性和量化屬性 分類屬性 n Categorical Attributes ¡ n 具有有限個不同值,值之間無序 Quantitative Attributes ¡ 數值類型的值,並且值之間有一個隱含的序 54
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Techniques for Mining MD Associations u 挖掘多維關聯規則的技術可以根據量化屬性的處理分為 量化屬性的處理 三種基本方法︰ 1. Using static discretization of quantitative attributes (量化 屬性的靜態離散化) n 使用預先定義的概念分層對量化屬性進行靜態地離散化 2. Quantitative association rules (量化關聯規則) n 根據資料的分佈,將量化屬性離散化到“箱” (bins) 3. Distance-based association rules (基於距離的關聯規則) n 考慮數據點之間的距離,動態地離散化量化屬性 55
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 56 Static Discretization of Quantitative Attributes u 量化屬性使用預先定義的概念分層,在挖掘 前進行離散化 u 數值屬性的值用區間代替 區間 u 如果任務相關資料存在資料庫中,則找出所 有頻繁的k-述語集將需要 k 或 k+1 次的Table 掃描 (age, income) u (age) (income) n-維方體的單元用於存放對應n-述語集的計 數或支持度,0 -D方體用于存放任務相關數據 的事務總數 如果包含感興趣的維的資料立方體已經存在 並物化,挖掘將會很快,同時可以利用 Apriori性質︰頻繁述語集的每個子集也必須 是頻繁的 (buys) (age, buys) (income, buys) 資料立方體技術非常適合挖掘多維關聯規則 n u () (age, income, buys)
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Quantitative Association Rules u 量化關聯規則中,數值屬性將根據某種挖掘標準,進行動 態的離散化 n u u 例如︰最大化挖掘規則的置信度和緊湊性. 為了簡化量化關聯規則挖掘的討論,我們將聚焦于類似以 下形式的2 -D quantitative association rules: Aquan 1 Aquan 2 Acat Example: (兩個量化屬性和一個分類屬性間的關聯) age(X, ” 30 -34”) income(X, ” 24 K - 48 K”) buys(X, ”high resolution TV”) 57
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) u 找出這類 2 -維量化關聯規則的方法︰關聯規則聚類系統 (ARCS) u 一種源於圖形處理的技術,該技術將量化屬性對映射到 滿足給定分類屬性條件的2 -D閘格上,然後透過搜索閘格 點的聚類而產生關聯規則 58
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) ARCS (Association Rule Clustering System) How does ARCS work? 1. Binning 2. Find frequent predicateset 3. Clustering 4. Optimize 59
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) u ARCS過程中的步驟包括: 1. 分箱 (根據不同分箱方法創建一個2 -D數組),本步驟的目的 在於減少量化屬性相對應的巨大的值個數,使得 2 -D閘格 的大小可控 n 等寬分箱 n 等深分箱 n 基於同質的分箱 (每個箱中Tuple一致分佈) 2. 找出頻繁述語集: n 掃描分箱後形成的2 -D數組,找出滿足最小支持度和置信度的頻繁 述語集 60
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 3. 關聯規則聚類 4. 將上一步得到的強關聯規則映射到 2 -D閘極格上,使用聚 類算法,掃描閘極格,搜索規則的矩形聚類 61
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) ARCS的局限性 u 所挖掘的關聯規則左手邊只能是量化屬性 u 規則的左手邊只能有兩個量化屬性(2 -D閘格的限制) u 一種不基於閘格的,可以發現更一般關聯規則的技術,其 中任意個數的量化屬性和分類屬性可以出現下規則的兩端 n 等深分箱動態劃分 n 根據部分完全性的度量進行聚類 62
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) 挖掘基於距離的關聯規則 u 因為未考慮資料點之間或區間的相對距離,分箱方法不是總能緊扣區 間資料的語義 u 等寬劃分將很近的值分開,並創建沒有數據的區間 等深劃分將很遠的值放在一組 基於距離的關聯規則挖掘考慮屬性值的接近性,緊扣區間資料的語義, 並允許值的類似 基於距離的關聯規則挖掘的兩遍算法︰ u u u 1. 使用聚類找出區間或簇 2. 搜索頻繁的一起出現的簇組,得到基於距離的關聯規則 63
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Interestingness Measurements u Objective measures Two popular measurements: ¶ ¶ u support; and confidence Subjective measures (Silberschatz & Tuzhilin, KDD 95) n 最終,只有用戶才能確定一個規則是否有趣的,而且這種判斷是 主觀的,因不同的用戶而異;通常認為一個規則(模式)是有趣 的,如果︰ ¡ ¡ u 它是出人意料的 可行動的(用戶可以使用該規則做某些事情) 挖掘了關聯規則後,哪些規則是用戶感興趣的?強關聯規 則是否就是有趣的? 64
資料探勘課程 (陳士杰) 國立聯合大學 資訊管理學系 65 Criticism to Support and Confidence u 例1︰(Aggarwal & Yu, PODS 98) n 在 10000個學生中 ¡ 7500個買影片 ¡ 6000個買遊戲片 ¡ 4000個學生既買影片又買遊戲片 買影片 不買影片 合計 (col. ) u 4000 2000 6000 不買遊戲片 3500 4000 合計 (row) 7500 2500 10000 上述數據可以得出 buys(X, “computer games”) => buys(X, “videos”) [40%, 60%] u 但其實全部人中買影片的人數是 75%,比 60%多;事實上影片和遊戲是負相關的。 負相關 u 由此可見A => B的置信度有欺騙性,它只是給出A, B條件機率的估計,而不度量A, B 間蘊涵的實際強度。
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) u We need a measure of dependent or correlated events u P(B|A)/P(B) is also called the lift of rule A => B u 若: n n corr. A, B >1表明A與B正相關; n u 項目集A的出現獨立於項目集B的出現時,P(A∪B) = P(A) P(B),即corr. A, B = 1,表明A與B無關; corr. A, B <1表明A與B負相關 將相關性指標用於前面的例子,可得出影片和遊戲的相關性為︰ P({game, video})/(P({game})×P({video}))=0. 4/(0. 75× 0. 6)=0. 89 u 結論︰影片和遊戲之間存在負相關 66
國立聯合大學 資訊管理學系 u 資料探勘課程 (陳士杰) 例︰(Aggarwal & Yu, PODS 98) n 在 5000個學生中 ¡ ¡ ¡ n n 3000個打籃球 3750個喝麥片粥 2000個學生既打籃球又喝麥片粥 然而,打籃球 => 喝麥片粥 [40%, 66. 7%]是錯誤的,因為全部學生 中喝麥片粥的比率是 75%,比打籃球學生的66. 7%要高 打籃球 => 不喝麥片粥 [20%, 33. 3%]這個規則遠比上面那個要精確, 儘管支持度和置信度都要低的多 67
國立聯合大學 資訊管理學系 資料探勘課程 (陳士杰) Summary u Association rule mining n probably the most significant contribution from the database community in KDD n A large number of papers have been published u Many interesting issues have been explored u An interesting research direction n Association analysis in other types of data: spatial data, multimedia data, time series data, etc. 68
de163b0a426894750fab4167669e31af.ppt