weka里Apriori算法涉及两篇文章,一篇是《Fast Algorithms for Mining Association Rules in Large Databases》 另外一篇《Integrating Classification and Association Rule Mining》 。在算法里区别体现在 m_car变量是否为真。 这一篇先说if( !m_car) 情况。
算法入口函数:public void buildAssociations(Instances instances)。
下面是部分代码示例:
if(!m_car){
// Find large itemsets and rules
findLargeItemSets();
if (m_significanceLevel != -1 || m_metricType != CONFIDENCE)
findRulesBruteForce();
else
findRulesQuickly();
}
else{
findLargeCarItemSets();
findCarRulesQuickly();
}
根据上面步骤,可以生成 m_allTheRules。例如,规则 P{A=>B}存在m_allTheRules里面就是 m_allTheRules[0]=A,m_allTheRules[1]=B,m_allTheRules[2]=P.
m_allTheRules[0] m_allTheRules[1] m_allTheRules[2] 分别又是三个数组,存了所有的规则。
先看 f