基于R语言的apriori算法介绍
(2015-02-06 15:33:30)
标签:
股票 |
分类: R语言 |
library(arules)
data(Groceries)
frequentsets=eclat(Groceries,parameter=list(support=0.05,maxlen=10))
inspect(frequentsets[1:10])
inspect(sort(frequentsets,by="support")[1:10])
rules=apriori(Groceries,parameter=list(support=0.01,confidence=0.01))
summary(rules)
x=subset(rules,subset=rhs%in%"whole
milk"&lift>=1.2)
inspect(sort(x,by="support")[1:5])
asahikawa重新翻译apriori关联挖掘包arules,详情如下:
apriori(arules)
apriori()所属R语言包:arules
----------描述如下----------
Mine frequent itemsets, association rules or association hyperedges using the Apriori algorithm.
The Apriori algorithm employs level-wise search for frequent itemsets.
在进行”项集频率、关联规则或关联超边“的挖掘是需要使用apriori算法。
Apriori算法在实现过程中会做一些改进(例如:前序树和项目分类)。
----------用法如下----------
apriori(data, parameter = NULL, appearance = NULL, control = NULL)
----------参数解释如下----------
参数:data
object of class transactions or any data structure which can be
coerced into transactions (e.g., a binary matrix or
data.frame).
可转换类别的实体或任何可以将其强制进行转换的数据结构(例如:一个二进制矩阵或数据框)。
参数:parameter
object of class APparameter or named list.
The default behavior is to mine rules with support 0.1,
confidence 0.8, and maxlen 10.
类别为APparameter的实体或命名列表。
默认的挖掘规则为:支持度0.1,置信度0.8,最大长度10(此处长度指结果个数)。
参数:appearance
object of class APappearance or named list.
With this argument item appearance can be restricted.
By default all items can appear unrestricted.
类别为APparameter的实体或命名列表。
使用该参数来控制对应项。
默认情况下,所有项目无限制。
参数:control
object of class APcontrol or named list.
Controls the performance of the mining algorithm (item sorting,
etc.)
对象的类APcontrol或命名列表。
控制挖掘算法的性能(例如:项目排序)
----------详细信息如下----------
Calls the C implementation of the Apriori algorithm by Christian
Borgelt for mining frequent itemsets, rules or hyperedges.
调用Christian Borgelt 所写的基于C语言实现的Apriori算法来挖掘“频繁项集,规则或超边”。
Note: Apriori only creates rules with one item in the RHS
(Consequent)!
注:Apriori算法在只有一个项目在RHS时(即结果为一个项目),才会创建规则。
Note: The default value in APparameter for minlen is 1.
This means that rules with only one item (i.e., an empty
antecedent/LHS)
like
注:APparameter的最小长度默认值是1。
这意味着将会创建只有一个项目的规则(即只有一个项目在LHS),例如
These rules mean that no matter what other items are involved
the
If you want to avoid these rules then use
这些规则意味着,无论其他什么项目与“在RHS中的项目”相关,都会根据概率给出规则置信度(相当于支持度)。
如果你想避免某些规则,那么就使用参数parameter=list(minlen=2)。
----------Value值----------
Returns an object of class rules or itemsets.
返回规则类或项目集的实体
----------References参考文献----------
between sets of items in large databases. In Proceedings of the
ACM SIGMOD International Conference on Management of Data, pages
207–216, Washington D.C.
Apriori Implementation. 15th Conference on Computational Statistics
(COMPSTAT 2002, Berlin, Germany) Physica Verlag, Heidelberg,
Germany.
Eclat.
参见----------See Also----------
APparameter-class, APcontrol-class, APappearance-class,
transactions-class, itemsets-class, rules-class
APparameter-class,APcontrol-class,APappearance-class,transactions-class,itemsets-class,rules-class
实例----------Examples----------
data("Adult")
## Mine association rules.[矿的关联规则。]
rules <- apriori(Adult,
summary(rules)