Data Mining Week3 - Association Rules & Decision List

关联式规则

(gender=male) and (wealth=rich) (age=old)

BODY HEAD

(LHS, “Left-Hand-Side”, antecendent) (RHS, consequent)

如果没有body,也可以有default head, the most common value (MCV) 

定义

SUPPORT: 数据中符合body规则的记录数,或者同时符合body和head
HITS: 数据中同时符合body和head (=SUPPORT(B ^ H))
SCORE: 用于评估rule的有效性(utility)的一个hits和support的函数
也叫做confidence(评价rule有多大可能是对的)

最简单的Score函数

score = fraction = hits / (body support),也就是P(head|body)通常叫做confidence of the rule

缺点:不能区分:

Rule1: support=10, hits=6
Rule2: support=1000, hits=600

所以改进为(置信区间Score方法



以上为一个Rule,如何自动得到一系列rules

 A PRIORI algorithm wiki 

1. Find support values for all item-sets of Size=1 

假设有一个数据库D,其中有4个事务记录,分别表示为:

TID Items
T1I1,I3,I4
T2I2,I3,I5
T3I1,I2,I3,I5
T4I2,I5

项集 支持度计数
{I1}2
{I2}3
{I3}3
{I4}1
{I5}3

2. Prune item-sets of current size with support < minimal_support (user-defined)

这里预定最小支持度minSupport=2

项集 支持度计数
{I1}2
{I2}3
{I3}3
{I5}3

3. If no item-sets of the current size survive pruning,  then stop; Otherwise continue
4. Increment item-set size: Size=Size+1升维,变成二维

项集
{I1,I2}
{I1,I3}
{I1,I5}
{I2,I3}
{I2,I5}
{I3,I5}
5. Find support values for all available item-sets of  the current Size (while doing so do not waste time checking 
item-sets consisting of already pruned components)

项集 支持度计数
{I1,I2}1
{I1,I3}2
{I1,I5}1
{I2,I3}2
{I2,I5}3
{I3,I5}2

比较候选项支持度计数与最小支持度minSupport,产生2维最大项目集L2:

项集 支持度计数
{I1,I3}2
{I2,I3}2
{I2,I5}3
{I3,I5}2

由L2产生候选项集C3:

项集
{I2,I3,I5}

扫描D,对每个候选项集进行支持度计数:

项集 支持度计数
{I2,I3,I5}2
 不需要包括(1,2)(1,5)(4),所以只剩(2,3,5)

算法结束

A Priori algorithm 简单,但是容易错过一些数据少但是有价值的rule,而且如果attributes的arity多,就超级费计算

Decision Lists

Problem: What if you have found 50 highest scoring rules and they all looked nearly alike?

1. Find the best rule
2. Store it at the top of the list
3. 剔除该rule cover的范围
4. Repeat (1) to (3) until no records left


如何判断Rule好坏Utility

Lift

和default对比的提升
Lift = P(H|B) / P(H)
• P(H|B)=fraction score ofthe rule (“confidence”) = hits / (body support)
P(H)也就是default,outset里面有多少符合head的

Correlation

“Corr” = P(H^B) / Sqrt[P(H)P(B)] 
P(H^B)数据中同时符合body和head,HITS
P(B)数据中符合body,support/总数
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值