Example usage for weka.associations AprioriItemSet generateRules

List of usage examples for weka.associations AprioriItemSet generateRules

Introduction

In this page you can find the example usage for weka.associations AprioriItemSet generateRules.

Prototype

public ArrayList<Object>[] generateRules(double minConfidence,
        ArrayList<Hashtable<ItemSet, Integer>> hashtables, int numItemsInSet) 

Source Link

Document

Generates all rules for an item set.

Usage

From source file:cba.Apriori.java

License:Open Source License

/** 
 * Method that finds all association rules.
 *
 * @throws Exception if an attribute is numeric
 *//*from  w w w  .j a v  a2 s .  c o  m*/
private void findRulesQuickly() throws Exception {

    FastVector[] rules;

    // Build rules
    for (int j = 1; j < m_Ls.size(); j++) {
        FastVector currentItemSets = (FastVector) m_Ls.elementAt(j);
        Enumeration enumItemSets = currentItemSets.elements();
        while (enumItemSets.hasMoreElements()) {
            AprioriItemSet currentItemSet = (AprioriItemSet) enumItemSets.nextElement();
            //AprioriItemSet currentItemSet = new AprioriItemSet((ItemSet)enumItemSets.nextElement());
            rules = currentItemSet.generateRules(m_minMetric, m_hashtables, j + 1);
            for (int k = 0; k < rules[0].size(); k++) {
                m_allTheRules[0].addElement(rules[0].elementAt(k));
                m_allTheRules[1].addElement(rules[1].elementAt(k));
                m_allTheRules[2].addElement(rules[2].elementAt(k));
            }
        }
    }
}