机器学习:关联分析

Apriori

频繁项集

频繁项集的评估标准有

支持度

关联的数据在数据集中出现的次数占总数据集的比重

Support(X)=P(X)=Count(X)Count(Samples)\mathrm{Support}(X) = P(X) = \frac{ \mathrm{Count}(X) }{ \mathrm{Count}(Samples) }

Support(X,Y)=P(XY)=Count(XY)Count(Samples)\mathrm{Support}(X,Y) = P(XY) = \frac{ \mathrm{Count}(XY) }{ \mathrm{Count}(Samples) }

置信度

一个数据出现后,另一个数据出现的概率,即数据的条件概率(XXYY发生的条件下发生的概率)。

Confidence(XY)=P(X  Y)=Support(X,Y)Support(Y)=P(XY)P(Y)\mathrm{Confidence}(X ⇐ Y) = P(X {\ \bold|\ } Y) = \dfrac{ \mathrm{Support}(X, Y) }{ \mathrm{Support}(Y) } = \dfrac{ P(XY) }{ P(Y) }

提升度

XXYY发生的条件下发生的概率,与XX总体发生的概率之比

Lift(XY)=Confidence(XY)P(X)=P(X  Y)P(X)=P(XY)P(X)P(Y)\mathrm{Lift}(X ⇐ Y) = \dfrac{ Confidence(X ⇐ Y) }{ P(X) } = \dfrac{ P(X {\ \bold|\ } Y) }{ P(X) } = \dfrac{ P(XY) }{ P(X)P(Y) }

提升度 关联强弱
Lift(XY)>1\mathrm{Lift}(X ⇐ Y) > 1 XYX ⇐ Y为有效的强关联
Lift(XY)<1\mathrm{Lift}(X ⇐ Y) < 1 XYX ⇐ Y为无效的强关联

要选择一个数据集合中的频繁数据集,则需要自定义评估标准。最常用的评估标准是用自定义的支持度,或者是自定义支持度置信度的一个组合。

Apriori算法

Apriori算法是常用的用于挖掘出数据关联规则的算法,它用来找出数据值中频繁出现的数据集合。

Apriori算法的目标是找到最大的KK项频繁集。

Example

规定最小支持计数为2

FP-tree

随着数据库容量的增大,Apriori算法重复访问数据库(外存)将导致性能低下。FP-tree算法对此进行了改进,减少了数据库的扫描次数和侯选集空间占用。

FP-tree算法

Example

最小支持度0.5